如何找到纬度,经度和时区的任何地方?

时间:2021-05-15 16:02:18

I am working on an iPhone application in which i want to find the latitude, longitude and timezone details of any place.

我正在开发一个iPhone应用程序,在该应用程序中,我希望找到任何位置的纬度、经度和时区细节。

How can i get all these details at a time.

我怎样才能一次获得所有这些细节。

we can find the latitude and longitude easily but how can we get the exact time zone of that place?

我们可以很容易地找到纬度和经度,但是我们怎样才能得到那个地方的确切时区呢?

Could any one please guide me ?

谁能给我带路吗?

Thanks.

谢谢。

6 个解决方案

#1


3  

It looks like you want this:-

看起来你想要这个:-

NSString *timeZoneName = [[NSTimeZone localTimeZone] name];

That returns "Asia/Kolkata" for me.

这给我带来了“亚洲/加尔各答”。

if you are using systemTimeZone then it represents the timezone used by the system (device) itself. The localTimeZone returns an object that represents the current default time zone for the application.

如果您正在使用systemTimeZone,那么它表示系统(设备)本身使用的时区。localTimeZone返回一个对象,该对象表示应用程序的当前默认时区。

use this API for getting the data and pass lat and long values.

使用此API获取数据并传递lat和long值。

Api for getting timeZone

Api获取时区

#2


1  

You can get Longitude and Latitude using CoreLocation.

您可以使用CoreLocation获取经度和纬度。

add this in your .h class where you want the latitude and longitude.

在您的.h类中添加这个,您需要纬度和经度。

#import <UIKit/UIKit.h>
#import <CoreLocation/CoreLocation.h>

@interface CoreLocationViewController : UIViewController <CLLocationManagerDelegate> {
    CLLocationManager *locationManager;
}
@property (retain, nonatomic) CLLocationManager *locationManager;
@end

And in your .m file

在你的。m文件中

#import "CoreLocationViewController.h"

@implementation CoreLocationViewController
@synthesize locationManager; 

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.

    [self setLocationManager:[[CLLocationManager alloc] init]];
    [locationManager setDelegate:self];
    [locationManager setDistanceFilter:kCLDistanceFilterNone]; 
    [locationManager setDesiredAccuracy:kCLLocationAccuracyHundredMeters];
    [locationManager startUpdatingLocation];
}

- (void)locationManager:(CLLocationManager *)manager 
    didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {

 NSLog(@"My Latitude %f",newLocation.coordinate.latitude);
 NSLog(@"My Latitude %f",newLocation.coordinate.longitude);

}

And for the current TimeZone you can use

对于当前时区,您可以使用

NSTimeZone* currentTimeZone = [NSTimeZone systemTimeZone];
NSDateFormatter *dateFormatter = [dateFormat setTimeZone:currentTimeZone];
NSDate *rightNow = [NSDate date];
NSString *dateString = [dateFormatter  stringFromDate:rightNow];

#3


1  

Get NSTimeZone from CLLocation: https://github.com/Alterplay/APTimeZones This utility works locally on device with no 3d party service.

从CLLocation获取NSTimeZone: https://github.com/alterplay/aptimezone这个实用工具在没有3d服务的设备上工作。

#4


0  

You can get time zone from any device by using

你可以通过使用任何设备获得时区

NSTimeZone* destinationTimeZone = [NSTimeZone systemTimeZone];

NSTimeZone* destinationTimeZone = [NSTimeZone systemTimeZone];

#5


0  

you are get location from CLLocationManager and you are also take a look at Geonames.org

您可以从CLLocationManager获得位置,还可以查看Geonames.org

It's a free webservice that allow you to get a lot of informations from a long/lat

这是一个免费的网络服务,可以让你从长/低的地方获得很多信息。

They also provide a free (and open source) Java Client for GeoNames Webservices library (library for other language also provided: ruby, python, perl, lisp...)

它们还为GeoNames web服务库提供了一个免费(和开源)Java客户机(其他语言的库也提供了:ruby、python、perl、lisp…)

Here's some info you can get from long/lat: (complete list of webservices here)

以下是你可以从long/lat获得的一些信息(完整的webservices列表)

Find nearest Address

找到最近的地址

Find nearest Intersection

找到最近的路口

Find nearby Streets

找到附近的街道

Elevation Timezone

海拔时区

#6


0  

If you want to know using api in that case you can get using this api but in this api first you find your latitude and longitude using CLLocationManager class and then put in this api.

如果你想知道在这种情况下使用api,你可以使用这个api,但是在这个api中,首先你使用CLLocationManager类找到你的经度和纬度,然后放入这个api。

http://ws.geonames.org/timezone?lat=#{lat}&lng=#{lng}

http://ws.geonames.org/timezone?lat= { lat }液化天然气= # {液化天然气}

And read google doc for more api.....

请阅读谷歌doc以获得更多的api……

https://developers.google.com/maps/documentation/timezone/

https://developers.google.com/maps/documentation/timezone/

i Hope it may help you

我希望它能对你有所帮助

#1


3  

It looks like you want this:-

看起来你想要这个:-

NSString *timeZoneName = [[NSTimeZone localTimeZone] name];

That returns "Asia/Kolkata" for me.

这给我带来了“亚洲/加尔各答”。

if you are using systemTimeZone then it represents the timezone used by the system (device) itself. The localTimeZone returns an object that represents the current default time zone for the application.

如果您正在使用systemTimeZone,那么它表示系统(设备)本身使用的时区。localTimeZone返回一个对象,该对象表示应用程序的当前默认时区。

use this API for getting the data and pass lat and long values.

使用此API获取数据并传递lat和long值。

Api for getting timeZone

Api获取时区

#2


1  

You can get Longitude and Latitude using CoreLocation.

您可以使用CoreLocation获取经度和纬度。

add this in your .h class where you want the latitude and longitude.

在您的.h类中添加这个,您需要纬度和经度。

#import <UIKit/UIKit.h>
#import <CoreLocation/CoreLocation.h>

@interface CoreLocationViewController : UIViewController <CLLocationManagerDelegate> {
    CLLocationManager *locationManager;
}
@property (retain, nonatomic) CLLocationManager *locationManager;
@end

And in your .m file

在你的。m文件中

#import "CoreLocationViewController.h"

@implementation CoreLocationViewController
@synthesize locationManager; 

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.

    [self setLocationManager:[[CLLocationManager alloc] init]];
    [locationManager setDelegate:self];
    [locationManager setDistanceFilter:kCLDistanceFilterNone]; 
    [locationManager setDesiredAccuracy:kCLLocationAccuracyHundredMeters];
    [locationManager startUpdatingLocation];
}

- (void)locationManager:(CLLocationManager *)manager 
    didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {

 NSLog(@"My Latitude %f",newLocation.coordinate.latitude);
 NSLog(@"My Latitude %f",newLocation.coordinate.longitude);

}

And for the current TimeZone you can use

对于当前时区,您可以使用

NSTimeZone* currentTimeZone = [NSTimeZone systemTimeZone];
NSDateFormatter *dateFormatter = [dateFormat setTimeZone:currentTimeZone];
NSDate *rightNow = [NSDate date];
NSString *dateString = [dateFormatter  stringFromDate:rightNow];

#3


1  

Get NSTimeZone from CLLocation: https://github.com/Alterplay/APTimeZones This utility works locally on device with no 3d party service.

从CLLocation获取NSTimeZone: https://github.com/alterplay/aptimezone这个实用工具在没有3d服务的设备上工作。

#4


0  

You can get time zone from any device by using

你可以通过使用任何设备获得时区

NSTimeZone* destinationTimeZone = [NSTimeZone systemTimeZone];

NSTimeZone* destinationTimeZone = [NSTimeZone systemTimeZone];

#5


0  

you are get location from CLLocationManager and you are also take a look at Geonames.org

您可以从CLLocationManager获得位置,还可以查看Geonames.org

It's a free webservice that allow you to get a lot of informations from a long/lat

这是一个免费的网络服务,可以让你从长/低的地方获得很多信息。

They also provide a free (and open source) Java Client for GeoNames Webservices library (library for other language also provided: ruby, python, perl, lisp...)

它们还为GeoNames web服务库提供了一个免费(和开源)Java客户机(其他语言的库也提供了:ruby、python、perl、lisp…)

Here's some info you can get from long/lat: (complete list of webservices here)

以下是你可以从long/lat获得的一些信息(完整的webservices列表)

Find nearest Address

找到最近的地址

Find nearest Intersection

找到最近的路口

Find nearby Streets

找到附近的街道

Elevation Timezone

海拔时区

#6


0  

If you want to know using api in that case you can get using this api but in this api first you find your latitude and longitude using CLLocationManager class and then put in this api.

如果你想知道在这种情况下使用api,你可以使用这个api,但是在这个api中,首先你使用CLLocationManager类找到你的经度和纬度,然后放入这个api。

http://ws.geonames.org/timezone?lat=#{lat}&lng=#{lng}

http://ws.geonames.org/timezone?lat= { lat }液化天然气= # {液化天然气}

And read google doc for more api.....

请阅读谷歌doc以获得更多的api……

https://developers.google.com/maps/documentation/timezone/

https://developers.google.com/maps/documentation/timezone/

i Hope it may help you

我希望它能对你有所帮助