GPS coordinates to street names

Is it possible to get the street name from a GPS coordinates ? Has someone an example ?

I think what you are searching for “geocoding” and “reverse geocoding”.
I habe no solution for Xojo, but there is a solution with OpenStreetMap: “Nominatim”
http://wiki.openstreetmap.org/wiki/Nominatim

Perhaps you can send the GPS coordinates with a HTTPSocket to Nominatim and get back the street.

[I don’t try it, but this could be a way, I would try.]

You can use iOS frameworks for that: CLGeocoder - reverseGeocodeLocation
The GPS coordinates are the required CLLocation.

In Xojo: no, I don’t.
But you’ll sure find examples in Objective C / Swift.

I have an example using Google Geocoding API.

I sent it to you by email

[quote=343041:@JrmieLeroy]I have an example using Google Geocoding API.

I sent it to you by email[/quote]
Would you mind emailing to me too please?

Last I checked – when Yahoo geocoding changed their licensing terms and I needed an alternative – Google Maps terms only allowed you to use the information for an interactive web page. And I needed for back office / accounting functions. So I ended up using Nominatim that Marcel linked above. But this was not in Xojo so I don’t have example code.

And the Google Map API terms may have become less restrictive since then as well. But verify your usage meets the current terms of their free level. Or consider their enterprise level.

[quote=342990:@Marcel Zimmer]I habe no solution for Xojo, but there is a solution with OpenStreetMap: “Nominatim”
http://wiki.openstreetmap.org/wiki/Nominatim
Perhaps you can send the GPS coordinates with a HTTPSocket to Nominatim and get back the street.[/quote]

Sure - i just tried quick and dirty:

[code]Dim oRequest As New HTTPSocket
oRequest.SetRequestHeader(“User-Agent”, “Xojo App”)
Dim sResult As String = oRequest.Get(“http://nominatim.openstreetmap.org/reverse?format=json&lat=52.5487429714954&lon=-1.81602098644987”, 10)

Dim oJSONResult As JSONItem

if (sResult <> “”) then
try
oJSONResult = New JSONItem(sResult)
catch err As JSONException
'could not parse
end try
end if

if (oJSONResult = nil) then return

'do something with oJSONResult[/code]

Then get the required information out of the JSON:

{"place_id":"88983844","licence":"Data © OpenStreetMap contributors, ODbL 1.0. http:\\/\\/www.openstreetmap.org\\/copyright","osm_type":"way","osm_id":"90394420","lat":"52.54877605","lon":"-1.81627033283164","display_name":"137, Pilkington Avenue, Sutton Coldfield, Birmingham, West Midlands Combined Authority, West Midlands, England, B72 1LH, United Kingdom","address":{"house_number":"137","road":"Pilkington Avenue","suburb":"Sutton Coldfield","city":"Birmingham","county":"West Midlands Combined Authority","state_district":"West Midlands","state":"England","postcode":"B72 1LH","country":"United Kingdom","country_code":"gb"},"boundingbox":["52.5487321","52.5488299","-1.8163514","-1.8161885"]}

The above code will need to be rewritten for an iOS project to use xojo.net.httpsocket and asynchronous calls.

But it might be a better solution than Google Geocoding API as it seems there is no rate limit with the OpenStreetMap API.

EDIT

There is a big restriction actually, not more than 1 request per second:
https://operations.osmfoundation.org/policies/nominatim/#requirements

sure, i just copy-pasted from a very similar Forum Thread in German. But I think it shows the basic how to.
It’s just a basic query to a WebService, such as explained in those Xojo Webinars:
http://developer.xojo.com/webinar-accessing-3rd-party-web-services
http://developer.xojo.com/webinar-web-services
Other services have a bit more overhead (registering for the API, sending some additional tokens, …), but you’ll get more of course if you register and pay.
The only “good & free” solution for iOS is probably the “built-in” CLGeoCoder… Not that complicated to use (i do so in my Xcode/Objective-C projects) - but I honestly don’t know what that would look like in Xojo-Declares…

CLGeoCoder doesn’t seem too complicated to setup. I’ll have a try later on.

Is not complicated, somewhere I should have the code. I used it for the demo of iosLocation class (before Xojo one) so it should be in this forum…