【问题标题】:X Y Conversion to lat lngX Y 转换为 lat lng
【发布时间】:2010-02-14 16:37:01
【问题描述】:

我在数据库中按 x ,y 和 shape 放置位置 如何将此位置点转换为纬度和经度对? 有没有工具或公式?

例如 x =220162.636213404 y = 762057.914609313 它应该是这样的 纬度 = 34.55667500000000000 lng = 31.68173300000000000

谢谢!

【问题讨论】:

  • x 和 y 是从哪里测量的?即你的数据库中的 x=0, y=0 在哪里?
  • 我有一个 sql 将数据插入到我的数据库中,列名是 pt_x_map 和 pt_y_map
  • X和Y的单位是什么?米?像素?还有什么?什么位置对应于 (x,y) = (0,0)?从您发布的值来看,这看起来像是一个非常不寻常的坐标系——我们需要更多信息来帮助您。

标签: c# google-maps maps proj4js


【解决方案1】:

有很多不同的地理坐标系。最常用的是WGS84(EPSG:4326)。谷歌地图使用自己的球面墨卡托投影,也就是俗称的谷歌墨卡托,但它的纬度值是WGS84坐标。

为了转换您的坐标,您必须知道源坐标系和目标坐标系。弄清楚这一点后,您可以使用像 Proj4js 这样的库来计算转换。

Proj4js 还提供了一个在线坐标计算器,它可以帮助您确定数据库中的坐标使用的是哪个坐标系。

如果您正在寻找 C# 框架:SharpMap 非常适合处理地理空间应用程序的各个方面。

【讨论】:

    【解决方案2】:

    这取决于您选择使用的projection model

    【讨论】:

    • 你的数据在世界的哪个角落。
    【解决方案3】:

    假设 x, y 是像素测量位置,您可以调整这个 sn-p:

    > public Class MyMapView extends MapView {
    
    

    .... /**
    * x,y are screen coordinates. The location l is set to the
    latitude and longitude that corresponds to this
    * point on the screen.
    */
    public void setLocation(double x, double y, Location l) {
    double latSpan = (getLatitudeSpan() / 1.0E6);
    double lngSpan = (getLongitudeSpan() / 1.0E6);
    Point center = getMapCenter();
    double xPcnt = x / ((double)getWidth());
    double yPcnt = y / ((double)getHeight());
    double lat0 = (center.getLatitudeE6()/1.0E6 + (latSpan/2.0));
    double lng0 = (center.getLongitudeE6()/1.0E6 - (lngSpan/2.0));
    double lat = lat0 - (yPcnt * latSpan);
    double lng = lng0 + (xPcnt * lngSpan);
    l.setLatitude(lat);
    l.setLongitude(lng);
    } ...

    取自: http://groups.google.com/group/android-developers/msg/f40fa714555c9617

    【讨论】:

    • 给出的样本 x 和 y 值大于 100 000。如果这些是像素坐标,avnic 的屏幕很大
    猜你喜欢
    • 2018-11-12
    • 2011-03-31
    • 1970-01-01
    • 1970-01-01
    • 2022-12-14
    • 2021-10-16
    • 2020-09-11
    • 2015-05-06
    • 1970-01-01
    相关资源
    最近更新 更多