Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 07-15-2011, 02:54 PM   #1 (permalink)
Registered Member
 
Join Date: Nov 2010
Posts: 104
Shades of Chaos is on a distinguished road
Default Get location from address

Hey all,

I am trying to use mapkit in my app and I have found lots of tutorials on how to find a location with longitude and latitude but none on how to find it with a street address. Is there a way to type in a street address and have the map go to that location.

Thanks
Clinton
Shades of Chaos is offline   Reply With Quote
Old 07-15-2011, 03:18 PM   #2 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 6,003
Duncan C has a spectacular aura about
Default

Quote:
Originally Posted by Shades of Chaos View Post
Hey all,

I am trying to use mapkit in my app and I have found lots of tutorials on how to find a location with longitude and latitude but none on how to find it with a street address. Is there a way to type in a street address and have the map go to that location.

Thanks
Clinton
There is not a way to do that directly with the MapKit. The Google Maps server API supports looking up a location by address. They impose their terms of service on using it.

They used to provide a simple, URL-based way of looking up an address. That method has been deprecated, however, and now you're supposed to use a JavaScript query. Our app, Save My Place, uses the older, simpler API, but I would suggest not using that, since it might not be supported for much longer.

Do a search on "Google Maps JavaScript API V3" to find their documentation on the subject. It will be listed under "Geocoding".
__________________
Regards,

Duncan C
WareTo

Check out our apps in the Apple App store


Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.

See this tutorial on using UIView animations and layer animations:

See this thread on generating random, non-repeating text

Check out a very cool Macintosh Kaleidoscopes app called ScopeWorks that we released to the Mac App store.
Duncan C is offline   Reply With Quote
Old 07-15-2011, 03:34 PM   #3 (permalink)
Nuisance Developer
 
Join Date: Jul 2009
Location: Italy
Posts: 4,691
dany_dev is on a distinguished road
Default

basically you need to do an http request to this address (use ASIHTTPRequest or NSURLConnection) and parse it with JSON Framework

Code:
http://maps.googleapis.com/maps/api/geocode/json?address=YourAddress&sensor=false
__________________
dany_dev is offline   Reply With Quote
Old 07-15-2011, 03:51 PM   #4 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 6,003
Duncan C has a spectacular aura about
Default

Quote:
Originally Posted by dany_dev View Post
basically you need to do an http request to this address (use ASIHTTPRequest or NSURLConnection) and parse it with JSON Framework

Code:
http://maps.googleapis.com/maps/api/geocode/json?address=YourAddress&sensor=false
...and beware of the Google terms of service. Read them carefully and make sure you comply. You're only supposed to use Google's servers if you present the results in a Google-branded map image, plus other restrictions. I don't remember the specifics,.
__________________
Regards,

Duncan C
WareTo

Check out our apps in the Apple App store


Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.

See this tutorial on using UIView animations and layer animations:

See this thread on generating random, non-repeating text

Check out a very cool Macintosh Kaleidoscopes app called ScopeWorks that we released to the Mac App store.
Duncan C is offline   Reply With Quote
Old 07-15-2011, 04:00 PM   #5 (permalink)
Registered Member
 
Join Date: Nov 2010
Posts: 104
Shades of Chaos is on a distinguished road
Default

I haven't used javascript very much before. But dany does your way require the google maps api or is that a link that can just be used?
Shades of Chaos is offline   Reply With Quote
Old 07-15-2011, 05:07 PM   #6 (permalink)
Nuisance Developer
 
Join Date: Jul 2009
Location: Italy
Posts: 4,691
dany_dev is on a distinguished road
Default

it is their api, but don't require a key api....

However as duncan said, read their license...

Quote:
Use of the Google Geocoding API is subject to a query limit of 2,500 geolocation requests per day. (User of Google Maps API Premier may perform up to 100,000 requests per day.) This limit is enforced to prevent abuse and/or repurposing of the Geocoding API, and this limit may be changed in the future without notice. Additionally, we enforce a request rate limit to prevent abuse of the service. If you exceed the 24-hour limit or otherwise abuse the service, the Geocoding API may stop working for you temporarily. If you continue to exceed this limit, your access to the Geocoding API may be blocked.

Note: the Geocoding API may only be used in conjunction with a Google map; geocoding results without displaying them on a map is prohibited. For complete details on allowed usage, consult the Maps API Terms of Service License Restrictions.
Google Maps/Google Earth APIs Terms of Service - Google Maps API Family - Google Code
__________________
dany_dev is offline   Reply With Quote
Old 07-15-2011, 05:51 PM   #7 (permalink)
Registered Member
 
Join Date: Nov 2010
Posts: 104
Shades of Chaos is on a distinguished road
Default

I tried typing in a street address just using my broswer and I got a json back with all the info. But when I tried adding in city, province it cam back with zero results.
Shades of Chaos is offline   Reply With Quote
Old 07-16-2011, 02:15 AM   #8 (permalink)
Nuisance Developer
 
Join Date: Jul 2009
Location: Italy
Posts: 4,691
dany_dev is on a distinguished road
Default

the documentation is here
The Google Geocoding API - Google Maps API Web Services - Google Code
__________________
dany_dev is offline   Reply With Quote
Reply

Bookmarks

Tags
address, gps, location, map, mapkit

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 356
7 members and 349 guests
apatsufas, Kirkout, lzwasyc, MarkC, Sami Gh, SamorodovAlex, VinceYuan
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,664
Threads: 94,120
Posts: 402,898
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Leslie80
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:40 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0