Consistent Lat/Long results returned?

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
rac
Posts: 10
Joined: Tue Sep 29, 2015 9:08 am

Consistent Lat/Long results returned?

Post by rac »

When xLocate is called to return a lat long from an postal address, where there is more than one result returned (quite normal), do the results always get returned in the same order? (i.e. if application code always used the first result in the list, would this be the same lat long every time?)
User avatar
Bernd Welter
Site Admin
Posts: 2703
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Re: Consistent Lat/Long results returned?

Post by Bernd Welter »

Hello Kevin,

the sorting order is preconfigured in the server side profile but you can override it via the optional parameters of the method.
See attached screenshot!

Best regards Bernd
view into the API doc of xLocate.findAddress
view into the API doc of xLocate.findAddress
rac
Posts: 10
Joined: Tue Sep 29, 2015 9:08 am

Re: Consistent Lat/Long results returned?

Post by rac »

Thank you for your quick response Bernd!

We have made no changes to the default sort order so does this mean repeated calls to xLocate with the same Post Code will always return the same sets of Lat/Long co-ordinates in the same order? We need to be sure we will always get the same results
User avatar
Bernd Welter
Site Admin
Posts: 2703
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Re: Consistent Lat/Long results returned?

Post by Bernd Welter »

Well, sounds like a different question... ;-)

As long as the server uses same map data (same provider, same annual version) and configuration the same input should generate the same output.

The default sorting order as it is part of native-default.xml is

Code: Select all

<SortingOrder SortFieldsNumber="17">
		<Field0 FieldName="Score.TotalScore" Ascending="false"/>
		<Field1 FieldName="AddressClassification" Ascending="false"/>
		<Field2 FieldName="PostalCode.Classification" Ascending="false"/>
		<Field3 FieldName="Street.Classification" Ascending="false"/>
		<Field4 FieldName="Town.Classification" Ascending="false"/>		
		<Field5 FieldName="IsCityDistrict" Ascending="true"/>
		<Field6 FieldName="HouseNr.Classification" Ascending="false"/>
		<Field7 FieldName="Population" Ascending="false"/>
		<Field8 FieldName="Country" Ascending="true"/>
		<Field9 FieldName="City" Ascending="true"/>
		<Field10 FieldName="City2" Ascending="true"/>
		<Field11 FieldName="PostalCode" Ascending="true"/>
		<Field12 FieldName="Street" Ascending="true"/>
		<Field13 FieldName="HouseNr" Ascending="true"/>
		<Field14 FieldName="CombinedTransport.Name" Ascending="true"/>
		<Field15 FieldName="CombinedTransport.Start.Name" Ascending="true"/>
		<Field16 FieldName="CombinedTransport.Destination.Name" Ascending="true"/>
	</SortingOrder>
So from my point of view this should be "deterministic" if you don't change the sorting order within the request and you apply equal search options.

Is this sufficient?

Best regards Bernd
rac
Posts: 10
Joined: Tue Sep 29, 2015 9:08 am

Re: Consistent Lat/Long results returned?

Post by rac »

Thank you Bernd, I believe so. I don't think I've ever had support this quickly, my thanks. kevin
Post Reply