如何检查纬度和经度是否在给定范围内?

时间:2015-12-18 13:27:24

标签: android geometry arcgis rectangles arcmap

我在Android应用程序中使用arcgis map作为离线地图,因此我下载了一个具有一定范围值的地图,即

{
  "xmin" : -12699130, 
  "ymin" : 3988230, 
  "xmax" : -12699130, 
  "ymax" : 5178858,
  "spatialReference" : {
    "wkid" : 3857
  }
}

现在我想应用我的逻辑:

  1. 让xy成为一些lat / long
  2. 如果xy在如上所述的指定范围区域内(意味着在我已下载的区域中)
  3. 然后打开arcgis地图,否则打开skobbler地图(用于离线街道地图),与arcgis离线地图相同,但只提供街景。
  4. 我尝试了以下代码:

    //First set the extent and made a envelope
    Envelope extentForTPK = new Envelope();
    extentForTPK.setCoords(-12699130,3988230,-12699130,5178858);
    
    //Then created a point from lat/long and checking if the point is inside the envelope(ie extentForTpk)
    Point wgspoint=new Point(lat, long);
    

    问题:

    首先,我无法将lat / long转换为积分,因此我认为这可能是问题所在。

    其次,我现在正在充气MapView并尝试mMapView.getSpatialReference()函数调用。

    最后,我的整个检查过程都是错误的。

0 个答案:

没有答案