these days a partner asked me how to determine ferries which are departing from a specific geocoded city. The first approach (SegmentsByCoordinateRequest) caused some simple issues and therefore not all required ferries have been found.
Then we moved on to use the SegmentsBySurroundingPolygonRequest and we identified the cause of the issue:
The departures in a city could be located in different coordinates and therefore in different distances from the SegmentsByCoordinateRequest(coordinate).
We therefore created a dummy polygon around the city coordinate and added some degrees. Now the next obstacle was the proper radius for the rectangle area. Of course the size of a meaningful radius depends on the cities own location but you may use this approach as a simple way to determine the ferries.
Update 2.3.2021:
Here's also a piece of code that describes how we determine the search radius based on a zoom level (xServer1):
Code: Select all
private int GetSearchRange(int zoomLevel)
{
return (18 - zoomLevel) * 10000 / 2;
}
private xServer.Client.ReverseSearchOption[] GetReverseSearchOptions(int zoomLevel)
{
if (zoomLevel == -1)
{
return null;
}
xServer.Client.ReverseSearchOption[] options = new xServer.Client.ReverseSearchOption[2];
options[0] = new xServer.Client.ReverseSearchOption();
//Represents the distance to search for results in meter
options[0].param = xServer.Client.ReverseSearchParameter.ENGINE_SEARCHRANGE;
options[0].value = GetSearchRange(zoomLevel).ToString();
options[1] = new xServer.Client.ReverseSearchOption();
options[1].param = xServer.Client.ReverseSearchParameter.ENGINE_SEARCHDETAILLEVEL;
options[1].value = "1";
return options;
}
Bernd