Skip to content
This repository was archived by the owner on Jan 28, 2026. It is now read-only.
This repository was archived by the owner on Jan 28, 2026. It is now read-only.

Geocoding.Google question: Which type (from types array) is returned in GoogleAddress.Type? #121

Open

Description

@johnnyoshika

Google returns types as an array:

{
   "results" : [
      {
         ...
         "types" : [ "locality", "political" ]
      }
   ],
   "status" : "OK"
}

XML version is similar:

<GeocodeResponse>
 <status>OK</status>
 <result>
  <type>locality</type>
  <type>political</type>
  ...
 </result>
</GeocodeResponse>

...but GoogleAddress.Type only supports one type: https://github.com/chadly/Geocoding.net/blob/master/src/Geocoding.Google/GoogleAddress.cs#L16-L19

Which type is returned?

I tried to read through the source code but it's a bit ambiguous: https://github.com/chadly/Geocoding.net/blob/master/src/Geocoding.Google/GoogleGeocoder.cs#L336-L374

Thanks!

Activity

  1. changed the title [-]Geocoding.Google question: Which type (from types array) is returned?[/-] [+]Geocoding.Google question: Which type (from types array) is returned in GoogleAddress.Type?[/+] on Jan 9, 2019
  2. johnnyoshika commented on Jan 11, 2019

    @johnnyoshika
    Author

    It seems like the first type is selected.

    Example:

    • address: Royal Jubilee Hospital
    • components: country:CA

    Result:

    <?xml version="1.0" encoding="UTF-8"?>
    <GeocodeResponse>
     <status>OK</status>
     <result>
      <type>establishment</type>
      <type>hospital</type>
      <type>point_of_interest</type>
      <formatted_address>1952 Bay St, Victoria, BC V8R 1J8, Canada</formatted_address>
    ...
    

    image

    Is there any way to access the others?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions