Integrate Google Maps API into an iPhone app

后端 未结 10 2240
南笙
南笙 2020-12-23 10:51

Update: iPhone SDk 3.0 now addresses the question here, however the NDA prevents any in depth discussion. Log in to the iPhone Dev Center if you need more info.

Ok

相关标签:
10条回答
  • 2020-12-23 11:25

    The easiest way to get a Google map using Cocoa is to use the "Static Maps API". In practice, you need to prepare an NSURL that you use to contact Google. You get back your map as NSData, that you transform to an NSImage. Note that you can do both geocoding and reverse geocoding. You can also embed markers on the map. However, you loose the full controls you have access to if you use their JavaScript API.

    Take a look at their reference guide here:

    http://code.google.com/apis/maps/documentation/staticmaps/

    0 讨论(0)
  • 2020-12-23 11:26

    Since iOS5 we have the following options as stated in the development doc: * "A geocoder object uses a network service to convert between latitude and longitude values and a user-friendly placemark, which is a collection of data such as the street, city, state, and country information. Reverse geocoding is the process of converting a latitude and longitude into a placemark. Forward geocoding is the process of converting place name information into a latitude and longitude value. Reverse geocoding is supported in all versions of iOS but forward geocoding is supported only in iOS 5.0 and later."*

    You can now use a CLGeocoder object.

    0 讨论(0)
  • 2020-12-23 11:34

    The big issue of course, is that the license agreement of both google and yahoo state you can't use these API's in "commercial applications". would hate to pub an app on the app store only to have it taken down and sued by yahoo or google. In reading the iPhone 3.0 map api and associated license this isn't mentioned but if you want an app to run on phones not upgraded....

    Is there an answer for this that won't get one in trouble?

    0 讨论(0)
  • 2020-12-23 11:35

    Actually, I did not meant reverse geocoding as "translating a point into a human-readable address", but rather visualizing a point using a Google Map (that can also, depending on the accuracy level, show a human-readable address). This is the basic functionality that was required.

    In practice, I just wanted to suggest the static maps API as a clean and fast way to:

    1) given the coordinates obtained from the iPhone GPS sensor, retrieve a Google Map showing the point

    2) given an address, transform it in the corresponding geographical coordinates and then use the coords to retrieve a Google Map showing the address given

    Both are possible using simple NSURLs involving the staticmap and geo services

    http://maps.google.com/staticmap? http://maps.google.com/maps/geo?

    passing of course the needed parameters to provide a suitable query string.

    Kind regards

    0 讨论(0)
提交回复
热议问题