2

Why is it that no type is returned when the address component is an Indian Reservation? It is just returned as shown below, and because there is no type, it causes an error when trying to geocode addresses that return an Indian Reservation.

<address_component>
 <long_name>Hopi Indian Reservation</long_name>
 <short_name>Hopi Indian Reservation</short_name>
</address_component>

Example addreses: HWY 160 & HWY 264 Tuba City, AZ 86045

OR

HWY 160 & HWY 163 Kayenta, AZ 86033

1 Answers1

4

I guess the documentation about Address Component Types is a bit too subtle as to (not mentioning) the fact that there is no guarantee that the types[] array will always contain something, or that hese types may also be returned within address_components[] arrays ... or may not.

Your example reproduces this behavior pretty well:

http://maps.googleapis.com/maps/api/geocode/json?sensor=false&address=Hopi%20Indian%20Reservation

The types[] array is empty for the first result and its first address component.

Short term, I think your (and everybody's) code should be ready to accept empty types[] arrays. Long term, I'd agree it'd be better to give every result at least one type. For the specific case of indian reservations, I've no idea which one (if any) of the available ones would make sense. Maybe one of...

  • political indicates a political entity. Usually, this type indicates a polygon of some civil administration.
  • colloquial_area indicates a commonly-used alternative name for the entity.
  • park indicates a named park.
  • point_of_interest indicates a named point of interest. Typically, these "POI"s are prominent local entities that don't easily fit in another category such as "Empire State Building" or "Statue of Liberty."

If anyone has a clear idea how to classify these in the available Address Component Types, please file a feature request for the Geocoding API ;)

miguev
  • 4,481
  • 21
  • 41