简体   繁体   English

如何从vesselfinder(EPSG:4326到EPSG:3857)重新创建坐标转换?

[英]How to recreate coordinate transformation from vesselfinder (EPSG:4326 to EPSG:3857)?

I'm currently trying to figure out how vesselfinder.com calculates its Box Boundaries (bbox) which they use to query data from their backend.我目前正在尝试弄清楚vesselfinder.com 如何计算其用于从后端查询数据的框边界(bbox)。

Given an input like: lat, lon = 59.8230, 22.9586给定如下输入: lat, lon = 59.8230, 22.9586

They fetch data by using this bbox: 13761899,35886447,13779795,35898097他们使用此 bbox 获取数据: 13761899,35886447,13779795,35898097

If I try to get a similar bbox by using bboxfinder.com , I get the following values, which aren't even close to what I was expecting: 2553560.4710,8358928.9331,2556565.4293,8360514.8411如果我尝试使用 bboxfinder.com 获得类似的bbox ,我会得到以下值,这些值甚至与我的预期不接近: 2553560.4710,8358928.9331,2556565.4293,8360514.8411

The website above is using EPSG:4326 (WGS 84) to EPSG:3857 (WHS 84 / Pseudo-Mercator) by default.上面的网站默认使用 EPSG:4326 (WGS 84) 到 EPSG:3857 (WHS 84 / Pseudo-Mercator)。 I tried to verify in the JS code of vesselfinder that they're using this conversion as well.我试图在vesselfinder 的JS 代码中验证他们也在使用这种转换。

    var c = new s.geom.MultiLineString(t);
    return c.transform('EPSG:4326', 'EPSG:3857'),

There are also the following ones mentioned, but I'm pretty sure, that it has to be the upper shown transformation.还提到了以下几个,但我很确定,它必须是上面显示的转换。

it = [
  new $('EPSG:3857'),
  new $('EPSG:102100'),
  new $('EPSG:102113'),
  new $('EPSG:900913'),

The questions now are: What am I doing wrong?现在的问题是:我做错了什么? / Where do I think wrong? /我认为哪里不对?

I also tried using Python for the conversion and even tried out the other mentioned EPSG:XXXXXX types, but haven't got the desired result.我还尝试使用 Python 进行转换,甚至尝试了其他提到的 EPSG:XXXXXX 类型,但没有得到想要的结果。 I also changed the order of both EPSG types when creating the Transformer, but again, not the desired results.在创建 Transformer 时,我还更改了两种 EPSG 类型的顺序,但同样不是预期的结果。

from pyproj import Transformer

TRAN_4326_TO_3857 = Transformer.from_crs("EPSG:4326", "EPSG:3857", always_xy=True)

lat = 59.823002
lon = 22.958583
expansion = 2000

res = TRAN_4326_TO_3857.transform(lng, lat)
bbox = (round(res[0]-expansion), round(res[1]-expansion), round(res[0]+expansion), round(res[1]+expansion))

print(bbox)
# (2455738, 8260436, 2655738, 8460436)

This one is close to the one I got from bboxfinder, but is again not even close to the bbox vesselfinder is using.这个与我从 bboxfinder 得到的很接近,但又与正在使用的 bbox 容器查找器不接近。

https://gis.stackexchange.com/a/370496 seems to have the math. https://gis.stackexchange.com/a/370496似乎有数学。

convertCoordinates(lon, lat) {
    var x = (lon * 20037508.34) / 180;
    var y = Math.log(Math.tan(((90 + lat) * Math.PI) / 360)) /
                  (Math.PI / 180);
    y = (y * 20037508.34) / 180;
    return [x, y];
}

Or, in C# ( https://gis.stackexchange.com/a/325551 )或者,在 C# ( https://gis.stackexchange.com/a/325551 )

public static double[] latLonToMeters(double lat, double lon)
{
    //Debug.Log(Mathd.Tan((90d + lat) * Mathd.PI / 720));
    //Debug.Log(Mathd.Tan((90d + lat) * Mathd.PI / 360d));
    double[] meters = new double[2];
    meters[0] = lat * originShift / 180d;
    meters[1] = Mathd.Log(Mathd.Tan((90d+lon) * Mathd.PI / 360d)) /
                   (Mathd.PI / 180d);
    //meters[1] = Mathd.Log(5) / (Mathd.PI / 180d);
    meters[1] = meters[1] * originShift / 180d;
    return meters;
}

In any case, note the website those came from;无论如何,请注意那些来自的网站; that may be a better place to get the algorithm.那可能是获得算法的更好地方。 (Then if you need help converting to your preferred language, come back here.) (然后,如果您在转换为首选语言时需要帮助,请返回此处。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将 EPSG:3857 ("web mercator") 中散景中瓷砖提供者的投影更改为我在 EPSG:4326 中的来源 - Change projection of tile provider in bokeh in EPSG:3857 ("web mercator") to my source's in EPSG:4326 使用 ccrs.epsg() 使用 EPSG 4326 坐标系绘制邮政编码周长形状文件 - Use ccrs.epsg() to plot zipcode perimeter shapefile with EPSG 4326 coordinate system 如何将 epsg:6991 以色列网格转换为 epsg:4326 wgs 84 python - how to convert epsg:6991 israeli grid to epsg:4326 wgs 84 python PROJ pyproj将EPSG 4326(WSG 84)转换为(EPSG 28992) - PROJ pyproj conversion of point EPSG 4326 (WSG 84) to (EPSG 28992) CRSError:无效的投影:epsg:4326:对于geopandas - CRSError: Invalid projection: epsg:4326: for geopandas 如何使用 GDAL/OGR 栅格化(在 jupyter notebook 中),EPSG 中矢量文件的 crs:4326 - How to rasterize (in a jupyter notebook) using GDAL/OGR , crs of vector file in EPSG: 4326 从 4326 到 3857 的 GeoPandas 重投影无法正常工作 - GeoPandas reprojection from 4326 to 3857 not working properly 将坐标系导出为 ESPG 代码:to_epsg() 或 ExportToEPSG() - Export coordinate system as ESPG code: to_epsg() or ExportToEPSG() 从 GeoDataFrame.crs 结果中提取 EPSG 代码 - Extract EPSG code from GeoDataFrame.crs result 如何在 Geopandas 中的 EPSG 之间切换(绘制和添加背景图) - How to switch between EPSG in Geopandas (Plotting and adding background map)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM