【问题标题】:Using arcgis iOS longitude and latitude to show location results in a incorrect location使用arcgis iOS经纬度显示位置导致位置不正确
【发布时间】:2014-01-07 10:34:59
【问题描述】:

全部

我是arcgis for iOS的新手,现在遇到一个奇怪的问题,我已经查看了其他线程但没有找到任何解决方案。

我想在我的图形图层上显示经度为 116.929167 纬度为 34.727222 的建筑物。我的基础地图图层位于 WGS84 空间参考。

但是,当我第一次尝试以下代码时,它会导致点错位。 注意:这个地方在中国江苏省的某个地方,但它被放置在中国湖南省。

//create an instance of a tiled map service layer
AGSTiledMapServiceLayer *tiledLayer = [[AGSTiledMapServiceLayer alloc] initWithURL:[NSURL URLWithString:kTiledMapServiceURL]];

//Add it to the map view
[self.mapView addMapLayer:tiledLayer withName:@"Tiled Layer"];

//release to avoid memory leaks

//set the callout delegate so we can display callouts
self.mapView.callout.delegate = self;

//add  graphics layer for the graphics
self.graphicsLayer = [AGSGraphicsLayer graphicsLayer];

//add the graphics layer to the map
[self.mapView addMapLayer:self.graphicsLayer withName:@"Graphics Layer"];

//zoom to china
AGSEnvelope *chinaEnv = [AGSEnvelope envelopeWithXmin:78.0000000
                                                ymin:0.4400000
                                                xmax:156.0000000
                                                ymax:75.0000000
                                    spatialReference:[AGSSpatialReference wgs84SpatialReference]];

[self.mapView zoomToEnvelope:chinaEnv animated:YES];

self.mapView.callout.customView = nil;

self.mapView.callout.accessoryButtonHidden = YES;

double longitude = 116.929167;
double latitude = 34.727222;

AGSPoint *graphicPoint = [AGSPoint pointWithX:longitude y:latitude spatialReference:[AGSSpatialReference wgs84SpatialReference]];

[self.mapView.callout showCalloutAt:graphicPoint screenOffset:CGPointMake(0, 0) animated:YES];

谁能告诉我为什么它不能显示正确的位置以及如何解决这个问题? 非常感谢您的时间和回答! 最好的问候。

【问题讨论】:

标签: ios map arcgis


【解决方案1】:

恐怕您混淆了 WGS84 Web Mercator 和 WGS84。

  • WGS84 Web Mercator:它是一个投影坐标系,被世界上大多数地图(google、esri、bing)使用
  • WGS84:纬度/经度

回到您的问题,我认为您的底图是 WGS84 Web Mercator。但您的地图点是 wgs84SpatialReference。你必须投影它。

希望这能解决您的问题。

【讨论】:

    猜你喜欢
    • 2018-06-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-31
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多