No Postal Call in the result address (French location)
No Postal Call in the result address (French location)
Hi, thanks for this forum...
I'm working for integration of xLocate-xRoute in a batch application. I found stonishing comportements that helps a lot BUT I don't understand how to manage the locate query in order to recieve the (french) postal Code. Nowadays this address field is obstinatively empty.
Input datas :
Addressquery object with name of the city in "city" and name of the departement in "State" (!!). Yes ! it works really fine but as I said :
The postal Code keeps empty after locate() and instead of the name of the departement, i found back ... the name of the "Région" !!! and the info "departement" disappears
I think I'm not far of the soluce but maybe the question is a bit too 'frenchy' for the API documentation
Last but not least, I was looking for the adress' field "Province" (read in your documentation about versions) that seems appropriate for french departement and... I never found it in our "on permise" implementation...
I'm integrating xServer in a J2EE application (java 8-Tomcat 9)
Hope my english not too bad...
EE
I'm working for integration of xLocate-xRoute in a batch application. I found stonishing comportements that helps a lot BUT I don't understand how to manage the locate query in order to recieve the (french) postal Code. Nowadays this address field is obstinatively empty.
Input datas :
Addressquery object with name of the city in "city" and name of the departement in "State" (!!). Yes ! it works really fine but as I said :
The postal Code keeps empty after locate() and instead of the name of the departement, i found back ... the name of the "Région" !!! and the info "departement" disappears
I think I'm not far of the soluce but maybe the question is a bit too 'frenchy' for the API documentation
Last but not least, I was looking for the adress' field "Province" (read in your documentation about versions) that seems appropriate for french departement and... I never found it in our "on permise" implementation...
I'm integrating xServer in a J2EE application (java 8-Tomcat 9)
Hope my english not too bad...
EE
- Bernd Welter
- Site Admin
- Posts: 2695
- Joined: Mon Apr 14, 2014 10:28 am
- Contact:
Re: No Postal Call in the result address (French location)
Bonjour EE,
could you please provide the request and response?
This makes it easier for us to analyse the problem.
Merci,
Bernd
PS: If the data is sensitive get back to Amar 1:1.
could you please provide the request and response?
This makes it easier for us to analyse the problem.
Merci,
Bernd
PS: If the data is sensitive get back to Amar 1:1.
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...
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...
Re: No Postal Call in the result address (French location)
Code: Select all
String baseUrl = "http://localhost:50000";
String str_url_locate = baseUrl + "/services/ws/XLocate?wsdl";
String str_url_route = baseUrl + "/services/ws/XRoute?wsdl";
URL url_locate = null;URL url_route = null;
try { url_locate = new URL(str_url_locate);
url_route =new URL(str_url_route);
} catch (MalformedURLException e2) {
e2.printStackTrace();return null; }
XLocate xLocate = (XLocate) new XLocate_Service(url_locate).getXlocate();
XRoute xRoute = (XRoute) new Route_Service(url_route).getXroute();
SearchOptions searchOptions = new SearchOptions();
searchOptions.setOutputCountryType(CountryType.ISO_3166_1_ALPHA_3);
for(TrajetBean trajet:listeTrajet) {
SearchByAddressRequest searchByAddressRequest_PRO = new SearchByAddressRequest();
Address address_PRO = new Address();
address_PRO.setCity(trajet.getLIBELLE_COMMPRO().substring(3));
// .mapDep convertit code département --> libellé département
address_PRO.setState(Constantes.mapDep.get(trajet.getLIBELLE_COMMPRO().substring(0,2)));
searchByAddressRequest_PRO.setAddress(address_PRO);
locationsResponse_PRO_addr = xLocate.searchLocations(searchByAddressRequest_PRO);
Location loc_PRO = locationsResponse_PRO_addr.getResults().get(0).getLocation();
trajet.setX_COMMPRO_1("" + loc_PRO.getReferenceCoordinate().getX());
trajet.setY_COMMPRO_1("" + loc_PRO.getReferenceCoordinate().getY());
trajet.setCODE_POSTAL_ECHO_COMMPRO_1(loc_PRO.getAddress().getPostalCode());
} catch (XServerException e1) {
e1.printStackTrace();}
for instance address.city="Gray" address.State = "Haute-Saone" (70)
reponse : address.city="Gray" address.State = "Bourgogne-Franche-Comté" (!) and all other fields to "" espaciely
PostalCode that we wuld need further.
NB What is Amar 1:1 ?
Re: No Postal Call in the result address (French location)
We must locate a town.
We know the name of the city and the name of the department (France)
For instance address.city="Gray", address.State= "Haute-Saone".
We transmit the queryAddress and the coordonates are ok.
BUT
Address.State has been replaced by the name of the region ! And the PostalCode = ""
I would like to tell more but they'are the only parameters i transmit to xserver.
We know the name of the city and the name of the department (France)
For instance address.city="Gray", address.State= "Haute-Saone".
We transmit the queryAddress and the coordonates are ok.
BUT
Address.State has been replaced by the name of the region ! And the PostalCode = ""
I would like to tell more but they'are the only parameters i transmit to xserver.
- Bernd Welter
- Site Admin
- Posts: 2695
- Joined: Mon Apr 14, 2014 10:28 am
- Contact:
Re: No Postal Call in the result address (French location)
Hi EE,
I assume your request looked like :
which produces a
The result is type of LOCALITY, not of POSTAL_CODE.
In the technical concepts you can get some more examples. The paragraph also mentions
- CITY_RETURNALLCITY2
- POSTCODE_AGGREGATE
- ( and >10 more)
Unfortunately the number of parameters caused us to have many discussions about "the proper individual settings" and we decided to have a more generic, simplified approach in xLocate2 (used by you).
Best regards,
Bernd
PS: If you look for
you get the POSTAL_CODE level:
I assume your request looked like :
Code: Select all
{
"$type": "SearchByAddressRequest",
"address": {
"city": "Gray",
"state" : "Haute-Saone"
}
}
Code: Select all
{
"$type": "LocationsResponse",
"results": [
{
"location": {
"referenceCoordinate": {
"x": 5.5908197883,
"y": 47.448688506
},
"address": {
"country": "France",
"state": "Bourgogne-Franche-Comté",
"province": "Haute-Saône",
"city": "Gray"
},
"formattedAddress": "Gray"
},
"matchQuality": {
"totalScore": 100,
"addressScores": {
"country": 0,
"state": 0,
"province": 100,
"city": 100
}
},
"type": "LOCALITY"
}
]
}
In the technical concepts you can get some more examples. The paragraph also mentions
So this is no mistake but a design decision. In xLocate1 the API offered parameters to control the search such asIn order to return a short list, the search algorithm will prefer more general record types over more detailed ones if they match the same input words (e.g. return a locality instead of listing all its postal codes).
- CITY_RETURNALLCITY2
- POSTCODE_AGGREGATE
- ( and >10 more)
Unfortunately the number of parameters caused us to have many discussions about "the proper individual settings" and we decided to have a more generic, simplified approach in xLocate2 (used by you).
Best regards,
Bernd
PS: If you look for
Code: Select all
{
"$type": "SearchByAddressRequest",
"address": {
"city": "Gray",
"state" : "Haute-Saone",
"postalCode" : "70100"
}
}
Code: Select all
{
"$type": "LocationsResponse",
"results": [
{
"location": {
"referenceCoordinate": {
"x": 5.5953292785,
"y": 47.439899396
},
"address": {
"country": "France",
"state": "Bourgogne-Franche-Comté",
"province": "Haute-Saône",
"postalCode": "70100",
"city": "Gray"
},
"formattedAddress": "70100 Gray"
},
"matchQuality": {
"totalScore": 100,
"addressScores": {
"country": 0,
"state": 0,
"province": 100,
"postalCode": 100,
"city": 100
}
},
"type": "POSTAL_CODE"
}
]
}
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...
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...
Re: No Postal Call in the result address (French location)
Many thanks !!!! I can see exactly what happens.
But things must be a bit different in javascript and in pure Java.
The address object has no getter/setter for the "province" !! It's embarassing !
Concerning the Postal Code : if we search with city-name, I understand that locate cannot delivrate the postal Code ?
Thanks for all
But things must be a bit different in javascript and in pure Java.
The address object has no getter/setter for the "province" !! It's embarassing !
Concerning the Postal Code : if we search with city-name, I understand that locate cannot delivrate the postal Code ?
Thanks for all
- Bernd Welter
- Site Admin
- Posts: 2695
- Joined: Mon Apr 14, 2014 10:28 am
- Contact:
Re: No Postal Call in the result address (French location)
Puh, I am not familiar with JAVA's style...
All Address properties are optional.
For a JavaScript based communication the elements may simply miss in the response if empty.
Here's your request now based on SOAP:
and it's response:
So while JSON/JavaScript simply removes the empty elements the SOAP/XML approach mentions them as "empty string" (line 9).
All Address properties are optional.
For a JavaScript based communication the elements may simply miss in the response if empty.
Here's your request now based on SOAP:
Code: Select all
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://xlocate.xserver.ptvgroup.com" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<xs:searchLocations>
<request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns3="http://xlocate.xserver.ptvgroup.com" xsi:type="ns3:SearchByAddressRequest" scope="globalscope" storedProfile="default" coordinateFormat="EPSG:4326">
<searchOptions outputCountryType="NAME"/>
<address state="Haute-Saone" city="Gray"/>
</request>
</xs:searchLocations>
</soap:Body>
</soap:Envelope>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Body>
<ns2:searchLocationsResponse xmlns:ns2="http://xlocate.xserver.ptvgroup.com">
<return>
<results type="LOCALITY">
<location formattedAddress="Gray">
<referenceCoordinate x="5.5908197883" y="47.448688506"/>
<address country="France" state="Bourgogne-Franche-Comté" province="Haute-Saône" postalCode="" city="Gray"
district="" subdistrict="" street="" houseNumber=""/>
</location>
<matchQuality totalScore="100.0">
<addressScores country="0.0" state="0.0" province="100.0" city="100.0"/>
</matchQuality>
</results>
</return>
</ns2:searchLocationsResponse>
</soap:Body>
</soap:Envelope>
Yes - unfortunately.Concerning the Postal Code : if we search with city-name, I understand that locate cannot delivrate the postal Code ?
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...
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...
Re: No Postal Call in the result address (French location)
Thanks a lot Bernd.
Everything's clear for us now.
Could you just take in count that at least one client, stuck to j2EE architecture, would appreciate to have the possibility to set the parameter "province" actualy absent in the "com.ptvgroup.xserver.xlocate.Address" Object
Best regard.
Emmanuel
Everything's clear for us now.
Could you just take in count that at least one client, stuck to j2EE architecture, would appreciate to have the possibility to set the parameter "province" actualy absent in the "com.ptvgroup.xserver.xlocate.Address" Object
Best regard.
Emmanuel