Articles with tag 'Longitude'

Objective-C: Getting information from Latitude and Longitude

I respond to Mirko asking me how to make the reverse proposed in How to get Latitude and Longitude in Objective-C .
From the values ​​of latitude and longitude, you can take advantage of the class MKReverseGeocoder to get a whole range of information, such as: the city, the state, the extended address, chap!

Continued ...

How to get Latitude and Longitude in Objective-C

The MapKit framework provides a lot of useful features, except the return Latitude and Longitude 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 . On Apple iPhone, or iPad, you can however overcome this obstacle by using a different Google services. Specifically, you can directly call the url:

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

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

1
200,8,41.9128300,12.2241172

). The first value, 200 , indicates that all is well ( 200 OK ). The second, 8 , is the Google accuracy parameter (1-10). The last two values ​​are, finally, latitude and longitude. Let us now see a possible prototype of a method to 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 ] ] ; [Address stringByAddingPercentEscapesUsingEncoding: 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;
}

Interesting notes

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

Source eg

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


Download Source

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

Continued ...

How to get latitutine and longitude in Google Maps

To find the coordinates of an address or latitude and longitude, we can use this simple and useful hack. Open your site in Google Maps . Once on the map look for the address you would like (eg 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 such as 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, through Google Maps, Latitude and Longitude obtain from a city name or street. The answer is yes! Using the Google Maps API geocoding service you can directly ask Google trasfromare our textual information (state, city, street) in geographical coordinates. You can try a sample online direct on the documementazione Google.

Continued ...