Page 1 of 1

xLocate.findCombinedTransportByLocation search parameters

Posted: Wed Mar 30, 2022 9:07 am
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

Re: xLocate.findCombinedTransportByLocation search parameter

Posted: Wed Mar 30, 2022 9:22 am
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

Re: xLocate.findCombinedTransportByLocation search parameter

Posted: Wed Mar 30, 2022 10:31 am
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

Re: xLocate.findCombinedTransportByLocation search parameter

Posted: Wed Mar 30, 2022 11:12 am
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

Re: xLocate.findCombinedTransportByLocation search parameter

Posted: Thu Mar 31, 2022 7:22 am
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

Re: xLocate.findCombinedTransportByLocation search parameter

Posted: Thu Mar 31, 2022 8:50 am
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

Re: xLocate.findCombinedTransportByLocation search parameter

Posted: Thu Mar 31, 2022 8:55 am
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"
      }
    ]
  }
}

Re: xLocate.findCombinedTransportByLocation search parameter

Posted: Thu Mar 31, 2022 8:56 am
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": []
    }
  ]
}

Re: xLocate.findCombinedTransportByLocation search parameter

Posted: Thu Mar 31, 2022 9:30 am
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