Monday, 2 September 2013

Partial search in google API

Partial search in google API

I want to use googles services to identify a town from a postcode or
partial name of the city. I do not find in the documentation how to send a
partial town name:
Ex: I'm looking for the city of Mulhouse FRANCE, I want to do a search
type "FRANCE%20MU* ".
this is the request tested :
http://maps.googleapis.com/maps/api/geocode/json?language=fr&sensor=true&country=france&address=FRANCE%20mu
Result of the query :
{
" results" : [
{
" address_components " [
{
" LONG_NAME ": " Mù "
" short_name ": " Mù "
"types" : [" SubLocality ", " political" ]
}
{
" LONG_NAME ": " Orthez "
" short_name ": " Orthez "
"types" : [ "locality ", " political" ]
}
{
" LONG_NAME ": " Pyrénées- Atlantiques "
" short_name ": " 64",
"types" : [" administrative_area_level_2 ", " political" ]
}
{
" LONG_NAME ": " Aquitaine "
" short_name ": " Aquitaine "
"types" : [" administrative_area_level_1 ", " political" ]
}
{
" LONG_NAME ": " France "
" short_name ": " FR "
"types" : [ "country ", " political" ]
}
{
" LONG_NAME ": " 64300 "
" short_name ": " 64300 "
"types" : [" postal_code "]
}
]
" formatted_address ": " Mù , 64300 Orthez, France "
"geometry" : {
"location" : {
"lat" : 43.49025 ,
"lng" : -0.803723
}
" location_type ": " APPROXIMATE "
" viewport ": {
"Northeast ": {
"lat" : 43.49834449999999 ,
"lng" : -0.7877156
}
" southwest ": {
"lat" : 43.48215440000001 ,
"lng" : -0.8197304000000001
}
}
}
"types" : [" SubLocality ", " political" ]
}
]
"status" : "OK"
}
The query return only exact town name, not partiel town name ... Thank you
in advance an idea or solution to achieve this partial query and good day
to you all.

No comments:

Post a Comment