简体   繁体   English

HTML5 Javascript - 在地图上使用纬度/经度而不实际绘制地图

[英]HTML5 Javascript - Using Lat/Lon on a map without actually drawing a map

I need to use Longitude and Latitude coordinates on a map that will be loaded in by an external program, and I need to be able to draw things on this map and be able to zoom in and out.我需要在将由外部程序加载的地图上使用经度和纬度坐标,并且我需要能够在该地图上绘制内容并能够放大和缩小。 Thing is, I cannot draw this map, and I need to be able to interact with both the map elements and with what I'm drawing.问题是,我无法绘制这张地图,我需要能够与地图元素和我正在绘制的内容进行交互。

I tried using Google, and found that I was able to control either my canvas or the map, but not both at the same time.我尝试使用 Google,发现我可以控制画布或地图,但不能同时控制两者。 Plus, I could not draw things properly on top of Google's map (I'm using Easel.js).另外,我无法在 Google 的地图上正确绘制东西(我使用的是 Easel.js)。

If anyone has any sources or advice, it will be much appreciated.如果有人有任何来源或建议,将不胜感激。

OK I figured this out with help from my web dev friend.好的,我在我的网络开发朋友的帮助下解决了这个问题。 He suggested I use Google Maps, and even though I have that whole "layering" issue (with all my events being captured in the canvas and not trickling down to the 'map-canvas' div), I should go and set up events that capture things like zoom and drag, and pipe them along to my Google Map, and the result is prefect for what I am looking for.他建议我使用谷歌地图,即使我有整个“分层”问题(我的所有事件都被捕获在画布中,而不是滴入“地图画布”div),我应该去设置事件捕获诸如缩放和拖动之类的内容,并将它们通过管道传输到我的 Google 地图,结果非常适合我正在寻找的内容。

So now I have my Easel.js canvas on top of my Google map, and I just have to set up lat/lng positions for my objects when I want them to be part of the map!所以现在我的 Easel.js 画布在我的谷歌地图顶部,当我希望它们成为地图的一部分时,我只需要为我的对象设置纬度/经度位置!

Thanks for the help, everyone!谢谢大家的帮助!

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM