Differences between geocoding services and gMap search

I want to get the latitude and longitude for this address: Boulevard de la Marne Zone industrielle, COULOMMIERS, 77120, France

I am adding api to my page:

<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=true"></script> 

When I use gmaps, the result is good, but when I want to get its API:

  geocoder = new google.maps.Geocoder(); geocoder.geocode({ 'address': myAdress, 'region': 'FR'}, function (results, status) {...}); 

It executes the following query:

 https://maps.googleapis.com/maps/api/js/GeocodeService.Search?4sBoulevard%20de%20la%20Marne%20%20Zone%20industrielle%20%20COULOMMIERS%2077120%20&7sUS&9sfr-FR&callback=_xdc_._lsoj9s&token=53058 

and the result is close to Bamako ...

If I use the borders of the viewport, it executes the following query:

 https://maps.googleapis.com/maps/api/js/GeocodeService.Search?4sBoulevard%20de%20la%20Marne%20%20Zone%20industrielle%20%20COULOMMIERS%2077120%20&6m6&1m2&1d40.513799&2d-5.844727000000034&2m2&1d51.727028&2d10.854491999999936&7sUS&9sfr-FR&callback=_xdc_._c84svr&token=29019 

It’s better (it’s in France), but it’s not that

The request works well on the google map website: https://maps.google.fr/maps?q=Boulevard+de+la+Marne++Zone+industrielle,++COULOMMIERS,+77120&hl=fr&ll=48.487486,3.922119&spn = 1.541855,4.22699 & sll = 50.485474,25.620117 & sspn = 23.748757,67.631836 & hq = Boulevard + de + la + Marne ++ Zone + industrielle, ++ COULOMMIERS, + 77120 & radius = 15000 & t = m & z = 9

It seems that the only way to get this is to make the following request: http://maps.googleapis.com/maps/api/geocode/json?address=Boulevard%20de%20la%20Marne%20Zone%20industrielle,%20COULOMMIERS,%2077120&components= country: FR & sensor = false

I don’t understand why the result is different when using the viewport, not the country (these two results are within the viewport).

+4
source share
2 answers

Boulevard de la Marne Zone industrielle, COULOMMIERS, 77120, France - this is not an address, this is a "place".

The geocoder finds the location of Via De La Marne from this entrance:

http://www.geocodezip.com/v3_example_geo2.asp?addr1=Boulevard de la Marne Zone industrielle, COULOMMIERS, 77120, France & geocode = 1

 Found 1 results for Boulevard de la Marne Zone industrielle, COULOMMIERS, 77120, France [ 0 ]: Av De La Marne, Bamako, Mali (12.6417952, -7.988396299999977) 

The first result of the API looks more correct:

http://www.geocodezip.com/v3_example_geo2.asp?addr1=Boulevard de la Marne Zone industrielle, COULOMMIERS, 77120, France & place = 1

 Found 20 results for Boulevard de la Marne Zone industrielle, COULOMMIERS, 77120, France [ 0 ]: Zone Industrielle, Boulevard de la Marne, Coulommiers, France (48.804329, 3.0923729999999523) [ 1 ]: Boulevard de la Marne, Coulommiers, France (48.803048, 3.092110000000048) [ 2 ]: 21 Boulevard de la Marne, Coulommiers, France (48.806634, 3.0937430000000177) ... 
+1
source

Two things play here.

"Boulevard de la Marne Zone industrielle, COULOMMIERS, 77120, France" is not recognized as a geocoding API address due to the "Industrial Zone" part. If you delete this part, it will work fine:

Boulevard de la Marne, COULOMMIERS, 77120, France

Also, I found what the (rare example) problem looks like in Google Maps data, but I don’t think that fixing this will help in the above problem.

The place is in a text search for links in Places:

https://maps.googleapis.com/maps/api/place/textsearch/json?radius=50000&location=0,0&query=Boulevard%20de%20la%20Marne%20Zone%20industrielle,%20COULOMMIERS,%2077120&key=YOUR_API_KEY

You will notice that address_components does not have a route component when querying for location information using its place_id. This means that the place is not connected with the road.

0
source

All Articles