简体   繁体   English

使用Openlayers 4时,标记在自定义地图上放错了位置

[英]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. 使用Openlayers 4时,标记在自定义地图上放错了位置(使用Imagestatic导入地图图像)。标记坐标从后端传递。这些标记坐标是从Openlayer外部的管理模板存储到数据库的。当我们将这些坐标传递给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. 我们找到了解决方案。在Openlayers中,原点始于左上角,在本例中,原点始于左下角,我们在将坐标传递给Openlayers之前应用了一个简单的变换。 (X, TOTAL _HEIGHT - Y) (X,总计_HEIGHT-Y)

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

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