简体   繁体   中英

Markers got misplaced on custom maps when using Openlayers 4

Markers got misplaced on custom maps (map images are imported using Imagestatic) when using Openlayers 4.The marker coordinates are passed from backend.These marker coordinates are stored to database from an admin template outside of Openlayer.markers positioned in admin side map are different when we pass those coordinates to openLayers. Is there any conversion methods to standardise the position of coordinates? marker coordinates are stored in pixels.

We found a solution for it.In Openlayers the origin starts at top left corner and in our case origin starts at bottom left corner, we applied a simple transformation before passing the coordinates to the Openlayers. (X, TOTAL _HEIGHT - Y)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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