Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address and AddressComponents #9

Open
pkieltyka opened this issue Jan 12, 2016 · 4 comments
Open

Address and AddressComponents #9

pkieltyka opened this issue Jan 12, 2016 · 4 comments
Assignees

Comments

@pkieltyka
Copy link
Member

I think it would be better if we're explicit on the data structure of a "place", as in lets make the components actual fields.

@xiam
Copy link
Contributor

xiam commented Jan 12, 2016

The Google Maps API returns an array of address_components that looks like this:

     "address_components" : [
         {
            "long_name" : "48",
            "short_name" : "48",
            "types" : [ "street_number" ]
         },
         {
            "long_name" : "Pirrama Road",
            "short_name" : "Pirrama Road",
            "types" : [ "route" ]
         },
         {
            "long_name" : "Pyrmont",
            "short_name" : "Pyrmont",
            "types" : [ "locality", "political" ]
         },
         {
            "long_name" : "NSW",
            "short_name" : "NSW",
            "types" : [ "administrative_area_level_1", "political" ]
         },
         {
            "long_name" : "AU",
            "short_name" : "AU",
            "types" : [ "country", "political" ]
         },
         {
            "long_name" : "2009",
            "short_name" : "2009",
            "types" : [ "postal_code" ]
         }
      ],

I'm going to add a new field like this one:

type AddressComponent struct {
  LongName string
  ShortName string
  Types []string
}

AddressComponents []AdressComponent

@pkieltyka
Copy link
Member Author

interesting. Perhaps we can normalize this into a struct something like...

type Place struct {
    Name string
    Address Address
}
Address struct {
    Street string
    City string
    State string
    Country string
}

doing a quick search I even found someone with a similar story.. http://brizzled.clapper.org/blog/2012/02/14/simple-address-standardization/

@xiam
Copy link
Contributor

xiam commented Jan 13, 2016

And nothing has changed much since then, the Google Maps API still uses the same format. If we stick to the values you are suggesting it won't be that difficult, we can try to copy the initial mapping from that article and keep making adjustments when necessary.

@pkieltyka
Copy link
Member Author

Yes please

On Jan 12, 2016, at 9:27 PM, José Carlos notifications@github.com wrote:

And nothing has changed much since then, the Google Maps API still uses the same format. If we stick to the values you are suggesting it won't be that difficult, we can try to copy the initial mapping from that article and keep making adjustments when necessary.


Reply to this email directly or view it on GitHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants