开发者

Overlay for plotting MGRS

开发者 https://www.devze.com 2023-01-23 19:30 出处:网络
I\'m trying to plot MGRS lines over a map in an overlay using OpenLayers (JavaScript). Where I\'m really having problems is identifying the strange squares (non-100kmx100km grids). Does anyone know wh

I'm trying to plot MGRS lines over a map in an overlay using OpenLayers (JavaScript). Where I'm really having problems is identifying the strange squares (non-100kmx100km grids). Does anyone know where I might find an algorithm for plotting these?

In particular, the information I have or can find is: Convert a Lat/Long to MGRS Convert a full MGRS string (i.e., 17SLA123678 but not 1开发者_StackOverflow社区7SLA) to Lat/Lon Convert Lat/Lon to screen pixel and vice-versa

Thanks!


I don't know the MGRS system, but the Proj4JS library may be useful. This is used to transform between coordinate systems, so you can set it up to convert from a coordsys to pixels, or more commonly from one coordsys to another.

it is open source, and broadly based on the well known proj.4 library, and interfaces with OpenLayers. Actually, OpenLayers uses proj4js to transform between different coordinate systems.


I just added some of that functionality to https://github.com/jaycrossler/js-maptools (uses Leaflet instead of OpenLayers). It will draw a polygon over the USNG/MGRS cell that the mouse is over.

0

精彩评论

暂无评论...
验证码 换一张
取 消