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

New addressFormat property #4

Closed
wants to merge 2 commits into from
Closed

New addressFormat property #4

wants to merge 2 commits into from

Conversation

DiegoMax
Copy link

Added new addressFormat property allowing the selection of different address formats with (for now) 2 types:

  • SVAddressFormatUS (the default) mantains original address format, ie: "400, South Boulevard"
  • SVAddressFormatSpanish: uses the reversed address format, usually used in Spanish speaking country, ie: "South Boulevard 400"

…address formats with (for now) 2 types:

- SVAddressFormatUS (the default) mantains original address format, ie: "400, South Boulevard"
- SVAddressFormatSpanish: uses the reversed address format, usually used in Spanish speaking country, ie: "South Boulevard 400"
…address formats with (for now) 2 types:

- SVAddressFormatUS (the default) mantains original address format, ie: "400, South Boulevard"
- SVAddressFormatSpanish: uses the reversed address format, usually used in Spanish speaking country, ie: "South Boulevard 400"
@samvermette
Copy link
Member

This seems like overkill. How about detecting the current locale with [NSLocale currentLocale] so that SVGeocoder knows which format to use?

@DiegoMax
Copy link
Author

Well for my current scenario I can't trust that, but feel free to
ignore the pull. Not sure why an optional property would be overkill
though :p

Cheers, Diego!

Sent from my iPhone

On 22/09/2011, at 15:58, Sam Vermette
reply@reply.github.com
wrote:

This seem like overkill. How about detecting the current locale with [NSLocale currentLocale] so that SVGeocoder knows which format to use?

Reply to this email directly or view it on GitHub:
#4 (comment)

@samvermette
Copy link
Member

Well it is overkill in the perspective that NSLocale could do the job. I'm curious, what's you particular use case?

@masced
Copy link

masced commented Sep 29, 2011

Fully agree to samvermette.
Country specific formatting of addresses should not be scope of geocoder, but rather a separate component which can be reused in other places (which do not involve geocoding eg.)

@samvermette
Copy link
Member

Well it could be in the scope of SVGeocoder, but it should be automatic in response to the current NSLocale. I shouldn't have to set some property to have it format the address in a specific locale (Apple doesn't do this and uses NSLocale).

@DiegoMax
Copy link
Author

In my specific usage scenario, i need to format the address based on the country the user actually is, as in, geographically speaking, hence, i can not trust NSLocale and thats why i wanted to have a property for each of the 4 or 5 possible address formats around the world, and switch depending on the user's location.
I understand that my case is a very rare one and i wanted to avoid the overhead of having an extra object just for address formatting.
Cheers, Diego.

@samvermette
Copy link
Member

By the way, you might want to have a look at the "language" parameter for the geocoding requests. For instance, this request here: http://maps.googleapis.com/maps/api/geocode/json?latlng=40.4264,-3.6877&sensor=true&language=es

returns "formatted_address" : "Calle de Serrano, 23, 28001 Madrid, España"

This obviously isn't supported by SVGeocoder, but thought maybe you'd be interested in knowing this.

@DiegoMax
Copy link
Author

I'm of course interested! thanks for the tip, maybe i can come with a better solution now, thanks!

On Sep 29, 2011, at 10:40 PM, Sam Vermette wrote:

By the way, you might want to have a look at the "language" parameter for the geocoding requests. For instance, this request here: http://maps.googleapis.com/maps/api/geocode/json?latlng=40.4264,-3.6877&sensor=true&language=es

returns "formatted_address" : "Calle de Serrano, 23, 28001 Madrid, España"

This obviously isn't supported by SVGeocoder, but thought maybe you'd be interested in knowing this.

Reply to this email directly or view it on GitHub:
#4 (comment)

@samvermette
Copy link
Member

I know this is not exactly what you were after, but I finally decided to push a fix for this. SVGeocoder now automatically uses the device's current locale to set that language parameter I mentionned. I also had forgotten that the formatted_address value is available through placemark.formattedAddress.

In other words, making that geocoding request from a spanish device should return a properly formatted address string.

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

Successfully merging this pull request may close these issues.

None yet

3 participants