Articles Tagged 'Latitude'

Objective-C: obtain information from Latitude and Longitude

I respond to Mirko asking me how to make the opposite case proposed in Getting Latitude and Longitude in Objective-C .
Starting from the values ​​of Latitude and Longitude you can use the class MKReverseGeocoder to obtain a range of information, such as: city, state, address in full, chap!

Continued ...

How to get Latitude and Longitude in Objective-C

The framework provides MapKit many useful features, except the return of Longitude and Latitude from an address. In JavaScript, for example, you can use the service provided by Google Geocoding and discussed in Google Maps: How to get Latitude and Longitude from an address . Apple iPhone or iPad, however, you can overcome this obstacle by using a different Google services. Specifically, you can call directly to the url:

1
http://maps.google.com/maps/geo?q = [address] & output = csv

Where is [indirizzo] to enter the string with the address you want to transform coordinates. The output returned is of type:

1
200,8,41.9128300,12.2241172

). The first value, 200 , indicates that everything went well ( 200 OK ). The second, 8 , Google is the accuracy parameter (1-10). The last two values ​​are, finally, latitude and longitude. Now we see a prototype of a method can be included in our applications:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
CLLocationCoordinate2D ) getLocationFromAddress : ( NSString * ) address { - (CLLocationCoordinate2D) getLocationFromAddress: ( NSString *) address {
urlString = [ NSString stringWithFormat : @ "http://maps.google.com/maps/geo?q=%@&output=csv" , NSString * urlString = [ NSString stringWithFormat: @ "% @ http://maps.google.com/maps/geo?q = & output = csv"
NSUTF8StringEncoding ] ] ; [StringByAddingPercentEscapesUsingEncoding address: NSUTF8StringEncoding]];

listItems = [ locationString componentsSeparatedByString : @ "," ] ; NSArray * ListItems = [locationString componentsSeparatedByString: @ ""];

/ / Int zoom = 0;
0.0 ; double latitude = 0.0;
0.0 ; double longitude = 0.0;

listItems count ] > = 4 && [ [ listItems objectAtIndex : 0 ] isEqualToString : @ "200" ] ) { if ([ListItems count]> = 4 & & [[ListItems objectAtIndex: 0] isEqualToString: @ "200"]) {
/ / Zoom = [[ListItems objectAtIndex: 1] intValue];
listItems objectAtIndex : 2 ] doubleValue ] ; Latitude = [[ListItems objectAtIndex: 2] doubleValue];
listItems objectAtIndex : 3 ] doubleValue ] ; longitude = [[ListItems objectAtIndex: 3] doubleValue];
{ Else {}
/ / Error
}
CLLocationCoordinate2D location;
location.latitude = latitude;
location.longitude = longitude;

return location;
}

Notes of interest

, alla stregua della funzione explode ( ) del PHP per intenderci. The string returned in locationString is "split" by the method componentsSeparatedByString , like the function explode ( ) in PHP for instance. I put the example I proposed - but commented - the code to retrieve even the Google accuracy parameter, precision or scale factor, denoted by zoom .

Source as

For completeness, I made ​​a small example application with which you can try the method proposed above, enter any address and the iPhone will show on the map.


Download Source

I thank the team devAPP for the inspiration of this article.

Continued ...

Getting latitutine and longitude in Google Maps

To find the coordinates of an address or latitude and longitude, we can use this simple and useful hacks. Open the site Google Maps . Once on the map looking for the address you want (for example via Cortese 10, Modena).

Continued ...

How to use Google Maps in Adobe Flash CS4

In Adobe Flash, you can use a wide range of external APIs provided by Web services like Facebook , Twitter or Flickr . In this tutorial we will see how to integrate, in a really simple, the services of Google Maps in a movie / application Adobe Flash CS4.

Continued ...

Google Maps: How to get Latitude and Longitude from an address

Also this time I reply to a comment with a post, given the general interest. Armando asked me if it was possible, using Google Maps, Latitude and Longitude obtained from a city name or street. The answer is yes! Using the Google Maps API geocoding service you can ask Google directly from reprocessing our textual information (state, city, etc.) in geographic coordinates. You can try an online example of documementazione Google directly on the site.

Continued ...