我正在尝试将不同人所在位置的纬度和经度值转换为网格状的2D显示,其中y=经度,x =纬度2D。如何使用html、css、java来实现这一点?我刚刚从另一个问题中发现,也许我可以使用ArcGis Api将这些值转换为X和Y。但如何将它们放置在屏幕上,以便它们具有正确的位置?
我有这个经纬度代码:
const getLocation = document.getElementById("btn");
getLocation.addEventListener("click", evt=> {
if("geolocation" in navigator) {
navigator.geolocation.getCurrentPosition(position=> {
let latitude = position.coords.latitude;
let longitude = position.coords.longitude;
console.log(latitude,longitude);
},error=>{
console.log(error.code);
});
}else {
console.log("not supported")
}
});
1条答案
按热度按时间bqujaahr1#
所以,你已经确定了你需要把纬度/经度转换成笛卡尔坐标,也就是x和y坐标。
我的解决方案是canvas api,你可以在上面画出你想要的东西。
所以,这里开始了...希望它能有所帮助!
第一个
编辑:link可能有助于将经度/纬度转换为笛卡尔坐标
下面是一个使用背景图像的版本: