xLocate.findCombinedTransportByLocation search parameters

deals with geocoding and reverse geocoding in the context of PTV Geocoding&Places, PTV Geocoding&Places OSM and PTV xLocate 1 and 2
Post Reply
innomedio
Posts: 27
Joined: Thu Sep 03, 2020 2:26 pm

xLocate.findCombinedTransportByLocation search parameters

Post by innomedio »

Dear Bernd,

We've started implementing the xLocate.findCombinedTransportByLocation endpoint for searching for train stations (piggyback)

This endpoint has a "options SearchOptionBase[] Additional search options." parameter.
However I couldn't find anywhere in the documentation nor the forum the concrete search options for this one.
Could you help me where to find it / or send me some examples?

com.ptvag.xserver.xlocate.XLocate.findCombinedTransportByLocation

Thank you in advance!
Peter
User avatar
Bernd Welter
Site Admin
Posts: 2695
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Re: xLocate.findCombinedTransportByLocation search parameter

Post by Bernd Welter »

Hello Peter,

the class "SearchOption" is a base class from which several other classes derive their specific properties. This is visible in this diagram.

You can find som additional info in the additional usecases documentation

That paragraph mentions some meaningful ReverseSearchOptions (Parameters):
  • ENGINE_TOLERANCE
  • ENGINE_TARGETSIZE
  • ENGINE_SEARCHRANGE
  • LANGUAGE_CODE
I hope this helps,

Bernd
Attachments
sample screenshot from an xlocate 1 testclient
sample screenshot from an xlocate 1 testclient
Bernd Welter
Technical Partner Manager Developer Components
PTV Logistics - Germany

Bernd at... The Forum,LinkedIn, Youtube, StackOverflow
I like the smell of PTV Developer in the morning... :twisted:
innomedio
Posts: 27
Joined: Thu Sep 03, 2020 2:26 pm

Re: xLocate.findCombinedTransportByLocation search parameter

Post by innomedio »

Dear Bernd,

I'm not quite sure how to pass the search params.
We've tried different ways to pass the search options you've mentioned, but it just won't work.

We're using the API with curl, addig the params json_encoded.

The original, working code was:

Code: Select all

$params = [
    'location' => [
        'coordinate' => [
            'point' => [
                'x' => $xCoord,
                'y' => $yCoord,
            ],
        ],
    ],
    'callerContext' => [
        'properties' => [
            [
                'key' => 'CoordFormat',
                'value' => 'OG_GEODECIMAL',
            ],
        ],
    ],
];
We've tried sg like this:

Code: Select all

$params = [
    'location' => [
        'coordinate' => [
            'point' => [
                'x' => $xCoord,
                'y' => $yCoord,
            ],
        ],
    ],
    'options' => [
        '$type': "SearchOption",
        'value': "-1",
        'param': 'ENGINE_SEARCHRANGE',
    ],
    'callerContext' => [
        'properties' => [
            [
                'key' => 'CoordFormat',
                'value' => 'OG_GEODECIMAL',
            ],
        ],
    ],
];
or this:

Code: Select all

$params = [
    'location' => [
        'coordinate' => [
            'point' => [
                'x' => $xCoord,
                'y' => $yCoord,
            ],
        ],
    ],
    'options' => [
        'ENGINE_TOLERANCE' => '160',
        'ENGINE_TARGETSIZE' => '20',
        'ENGINE_FILTERMODE' => '-1',
        'ENGINE_SEARCHRANGE' => '-1',
    ],
    'callerContext' => [
        'properties' => [
            [
                'key' => 'CoordFormat',
                'value' => 'OG_GEODECIMAL',
            ],
        ],
    ],
];
How should we set the options param in JSON/CURL?

Thank you,
Peter
User avatar
Bernd Welter
Site Admin
Posts: 2695
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Re: xLocate.findCombinedTransportByLocation search parameter

Post by Bernd Welter »

Hello Peter,

here comes a sample - I gues you have to qualify the class name with the proper type... the ReverseSearchOption

Code: Select all

{
  "location": {
    "coordinate": {
      "point": {
        "x": 10.13224,
        "y": 54.32325
      }
    }
  },
  "options": [
    {
      "$type":"ReverseSearchOption",
      "param":"ENGINE_SEARCHRANGE",
      "value":"700"
    }
  
  ],
  "callerContext": {
    "properties": [
      {
        "key": "CoordFormat",
        "value": "OG_GEODECIMAL"
      }
    ]
  }
}
Bernd
Bernd Welter
Technical Partner Manager Developer Components
PTV Logistics - Germany

Bernd at... The Forum,LinkedIn, Youtube, StackOverflow
I like the smell of PTV Developer in the morning... :twisted:
innomedio
Posts: 27
Joined: Thu Sep 03, 2020 2:26 pm

Re: xLocate.findCombinedTransportByLocation search parameter

Post by innomedio »

Hello Bernd,

Thank you! It's working this way:

Code: Select all

    'options' => [
        [
        '$type' => 'ReverseSearchOption',
        'value' => '-1',
        'param' => 'ENGINE_SEARCHRANGE',
        ],
        [
        '$type' => 'ReverseSearchOption',
        'value' => '-1',
        'param' => 'ENGINE_FILTERMODE',
        ],
        [
        '$type' => 'ReverseSearchOption',
        'value' => '1600',
        'param' => 'ENGINE_TOLERANCE',
        ],
        [
        '$type' => 'ReverseSearchOption',
        'value' => '200',
        'param' => 'ENGINE_TARGETSIZE',
        ]
    ],
One last question, which we couldn't figure out:
- all of the results are ferrys (type -> 1)
- which options do we need to set to also get back piggyback train connections?

Thank you,
Peter
User avatar
Bernd Welter
Site Admin
Posts: 2695
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Re: xLocate.findCombinedTransportByLocation search parameter

Post by Bernd Welter »

Hi Peter,
here's a sample that returns a train connection: the Sylt Shuttle from Niebüll

Code: Select all

{
  "location": {
    "coordinate": {
      "point": {
        "x": 8.82716,
        "y": 54.78669
      }
    }
  },
  "options": [
    {
      "$type":"ReverseSearchOption",
      "param":"ENGINE_SEARCHRANGE",
      "value":"7000"
    }
   
  ],
  "callerContext": {
    "properties": [
      {
        "key": "CoordFormat",
        "value": "OG_GEODECIMAL"
      }
    ]
  }
}
So you should be able to locate the train connections without further parameters. The challenge is more to identify whether this is a train or a ferry ;-)

Bernd
Attachments
Syltshulttle train connection between NIebüll and Westerland (Sylt)
Syltshulttle train connection between NIebüll and Westerland (Sylt)
Bernd Welter
Technical Partner Manager Developer Components
PTV Logistics - Germany

Bernd at... The Forum,LinkedIn, Youtube, StackOverflow
I like the smell of PTV Developer in the morning... :twisted:
User avatar
Bernd Welter
Site Admin
Posts: 2695
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Re: xLocate.findCombinedTransportByLocation search parameter

Post by Bernd Welter »

and here comes the Channel tunnel:

Code: Select all

{
  "location": {
    "coordinate": {
      "point": {
        "x": 1.17795,
        "y": 51.08447
      }
    }
  },
  "options": [
    {
      "$type":"ReverseSearchOption",
      "param":"ENGINE_SEARCHRANGE",
      "value":"7000"
    }
    
  ],
  "callerContext": {
    "properties": [
      {
        "key": "CoordFormat",
        "value": "OG_GEODECIMAL"
      }
    ]
  }
}
Attachments
Eurotunnel
Eurotunnel
Bernd Welter
Technical Partner Manager Developer Components
PTV Logistics - Germany

Bernd at... The Forum,LinkedIn, Youtube, StackOverflow
I like the smell of PTV Developer in the morning... :twisted:
Joost
Posts: 310
Joined: Fri Apr 25, 2014 1:46 pm

Re: xLocate.findCombinedTransportByLocation search parameter

Post by Joost »

The challenge is more to identify whether this is a train or a ferry
You can check the type attribute to see if something is a ferry or a piggyback (== api term for rail shuttle).
See https://xserver.ptvgroup.com/fileadmin/ ... dTransport

If i run Bernd Niebüll sample: the resulting type is 2, which according to the documentation means it is a piggyback.

Code: Select all

{
  "errorCode": 0,
  "errorDescription": "",
  "resultList": [
    {
      "id": "VjEoNDk7MTEyNjQ1NTEzNjsxNzI7MjEwOzApKDQ5OzExMjMzMDk0Mjg7MTI3OzE5MDswKU5pZWLDvGxsIC0gV2VzdGVybGFuZA==",
      "name": "Niebüll - Westerland",
      "duration": 3401,
      "distance": 1089.407079898105,
      "type": 2,
      "start": {
        "coordinate": {
          "$type": "Point",
          "point": {
            "$type": "PlainPoint",
            "x": 8.8404412179,
            "y": 54.780580254
          }
        },
        "country": "D",
        "name": "Niebüll"
      },
      "destination": {
        "coordinate": {
          "$type": "Point",
          "point": {
            "$type": "PlainPoint",
            "x": 8.3111510833,
            "y": 54.906602861
          }
        },
        "country": "D",
        "name": "Westerland"
      },
      "combinedTransportFields": []
    }
  ]
}
Joost Claessen
Senior Technical Consultant
PTV Benelux
innomedio
Posts: 27
Joined: Thu Sep 03, 2020 2:26 pm

Re: xLocate.findCombinedTransportByLocation search parameter

Post by innomedio »

Hi Bernd, Hi Joost,

Thank you! It's ok now. Your examples are valid. :)
We just need to channel these ids to the routing engine.

Thank you for the help!

Peter
Post Reply