Gathering ferries with xdata

Data which is used in a more general manner can be requested by xData service. Therefore this data is not provided by one of the other functional services, but concentrated in an own independent service.
Attention: this is not the platform for the data itself. If you have questions about missing data or the handling of binary maps please look at Data and Content.
Post Reply
User avatar
Bernd Welter
Site Admin
Posts: 2860
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Gathering ferries with xdata

Post by Bernd Welter »

Cheers,

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.
The radius of the rectangles in x/y directions are 0.01, 0.02, 0.03, 0.04 and 0.05 degrees. <br />Very silly approach - but simple.
The radius of the rectangles in x/y directions are 0.01, 0.02, 0.03, 0.04 and 0.05 degrees.
Very silly approach - but simple.
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;
}
Best regards,
Bernd
Attachments
for Amsterdam I took delta_x=0.5 degrees and delta_y=0.25 degrees (and 1.0/0.5 and 2.0/1.0)
for Amsterdam I took delta_x=0.5 degrees and delta_y=0.25 degrees (and 1.0/0.5 and 2.0/1.0)
Dover / UK
Dover / UK
Barcelona / Spain
Barcelona / Spain
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:
Post Reply