0

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

例如 x =220162.636213404 y = 762057.914609313 它应该类似于 lat = 34.55667500000000000 lng = 31.68173300000000000

谢谢!

4

3 回答 3

2

There are a lot of different geographic coordinate systems. The most commonly used is WGS84 (EPSG:4326). Google Maps uses it's own spherical mercator projection which is commonly known as Google Mercator, but its latlong values are WGS84 coordinates.

In order to transform your coordinates you have to know the source and destination coordinate system. Once you have figured this out you can use a library like Proj4js to calculate the transformation.

Proj4js also provides an online coordinate calculator, which might help you to figure out which coordinates system the coordinates in your database are using.

If you are looking for a C# framework: SharpMap is great for handling all aspects of geospatial applications.

于 2010-02-14T16:49:26.853 回答
1

这取决于您选择使用的投影模型。

于 2010-02-14T16:43:12.953 回答
0

假设 x, y 是像素测量的位置,您可以调整以下代码段:

> 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

于 2010-02-14T16:41:24.177 回答