如果可以将{strong>(X,Y)的点转换为(lat,lon),并给出X_left < X_point < X_right
和Y_bottom < Y_point <Y_top
(即在一个矩形框内)。
(X_left,Y_bottom)点已经有(lat,lon),与构成矩形形状的其他3个点相同(在这种情况下为平面图)
一些现实世界的数据:
"floor_name": "buildingName_floor_4",
{
"name": "GPS_Marker_0",
"GeoCoordinate": {
"latitude": 1.298825,
"longitude": 103.77004,
"unit": "DEGREES"
},
"MapCoordinate": {
"x": 0,
"y": 0,
"unit": "FEET"
}
},
{
"name": "GPS_Marker_1",
"GeoCoordinate": {
"latitude": 1.298825,
"longitude": 103.77134,
"unit": "DEGREES"
},
"MapCoordinate": {
"x": 473.9,
"y": 0,
"unit": "FEET"
}
},
{
"name": "GPS_Marker_2",
"GeoCoordinate": {
"latitude": 1.29694,
"longitude": 103.77134,
"unit": "DEGREES"
},
"MapCoordinate": {
"x": 474.7,
"y": 683.8,
"unit": "FEET"
}
},
{
"name": "GPS_Marker_3",
"GeoCoordinate": {
"latitude": 1.29694,
"longitude": 103.77004,
"unit": "DEGREES"
},
"MapCoordinate": {
"x": 0,
"y": 683.8,
"unit": "FEET"
}
}
Access Point (need to get lat,lon from its X,Y)
"name": "AP_No_4",
"radioMacAddress": "xx:xx:xx:xx:xx:xx"
"MapCoordinate": {
"x": 179.8,
"y": 299,
"unit": "FEET"
},
我知道我们可能需要在应用任何数学之前弄清楚映射投影,但让我解释一下这个矩形框(即平面图)通常不是那么大,所以接受了一些错误(例如1米或2)。 / p>
我更喜欢javascript代码,但如果你能指出这样做的公式,我很乐意研究代码。感谢。
答案 0 :(得分:1)
我相信Maps JavaScript API中有一种方法可以做到这一点。初始化地图后,您可以使用Map类的getProjection()方法检索投影:
https://developers.google.com/maps/documentation/javascript/3.exp/reference#Map
之后你可以使用fromPointToLatLng(pixel:Point,nowrap?:boolean)投影方法:</ p>
https://developers.google.com/maps/documentation/javascript/3.exp/reference#Projection
文档中有一篇文章解释了不同类型的坐标:
https://developers.google.com/maps/documentation/javascript/maptypes#MapCoordinates
希望它有所帮助!