0

When using googles geolocation, sending in just random numbers or an address that does not exist, it still gives us an answer with a location somewhere.

Why does it give a location on an address that clearly does not exist?

Example.

http://maps.googleapis.com/maps/api/geocode/xml?address=sdfsdfsdfsdf%209999999%20ghkhkgh&components=country:SE&sensor=false

Result

<result>
  <type>country</type>
  <type>political</type>
  <formatted_address>Sweden</formatted_address>
  <address_component>
    <long_name>Sweden</long_name>
    <short_name>SE</short_name>
    <type>country</type>
    <type>political</type>
  </address_component>
  <geometry>
<location>
  <lat>60.1281610</lat>
  <lng>18.6435010</lng>
</location>
<location_type>APPROXIMATE</location_type>
<viewport>
  <southwest>
    <lat>55.3367024</lat>
    <lng>10.9683721</lng>
  </southwest>
  <northeast>
    <lat>69.0599709</lat>
    <lng>24.1660240</lng>
  </northeast>
</viewport>
<bounds>
  <southwest>
    <lat>55.3367024</lat>
    <lng>10.9631866</lng>
  </southwest>
  <northeast>
    <lat>69.0599709</lat>
    <lng>24.1668093</lng>
  </northeast>
</bounds>
  </geometry>
  <partial_match>true</partial_match>
</result>
noshitsherlock
  • 1,103
  • 2
  • 11
  • 28
  • 2
    That is the [geocoder](https://developers.google.com/maps/documentation/javascript/geocoding#Geocoding)'s job, to find the best match for a given input. It is _not_ an address validator (although people have attempted to use it as one). – geocodezip Dec 02 '14 at 15:54
  • 1
    You could ignore locations with the type: `APPROXIMATE` and/or look at the result and see that it is the same as that for the country. – geocodezip Dec 02 '14 at 16:06

0 Answers0