I am trying to add point features on a vector layer but for some reason the markers is always on the same place in this case on the Equator. The default projection for map views in OpenLayers 3 is Web Mercator. In this projection, your units are in meters. So the geometry you create above is 15 meters east and 20 meters north (of the equator at the prime meridian). You can use the ol.proj package to get transform functions for geometries. // create a point in the Web Mercator CRS given longitude and latitude var geometry = new ol.geom.Point([15, 20]), geometry.transform(ol.proj.getTransform('EPSG:4326', 'EPSG:3857')), The EPSG:4326 and EPSG:3857 strings identify Geographic/WGS84 and Web Mercator coordinate reference systems. I can see a handful of ways this could be made more convenient. I'll create tickets for a couple of them now. Tim PS - Note that a slightly more convenient method for point geometries is to use the ol.proj.transform function. But this only works for point coordinates. var geometry = new ol.geom.Point(ol.proj.transform([15, 20], 'EPSG:4326', 'EPSG:3857')), On Thu, May 1, 2014 at 12:54 PM, Quintin Orsmond via OL3 Dev <, >, wrote: >, >, >, I am trying to add point features on a vector layer but for some reason the >, markers is always on the same place in this case on the Equator. >, >, var iconFeature = new ol.Feature({ >, geometry: new ol.geom.Point([15, 20]), //Point is not correctly drawn >, on the map >, name: 'Null Island', >, population: 4000, >, rainfall: 500 >, }), >, >, >, I used the Icon example, and here is a plunk , you can try to change the >, geometry of the iconFeature. >, >, So is this a bug or is there something that I am missing? >, >, Thanks. >, >, -- >, >, --- >, You received this message because you are subscribed to the Google Groups >, 'OL3 Dev' group. >, To unsubscribe from this group and stop receiving emails from it, send an >, email to If you're using ol3 master, the transform method for geometries has been changed. It is now possible to do the following: var point = new ol.geom.Point([15, 20]).transform('EPSG:4326', 'EPSG:3857'), The previous method of supplying a transform function has been renamed to applyTransform. See >, wrote: >, The default projection for map views in OpenLayers 3 is Web Mercator. >, In this projection, your units are in meters. So the geometry you >, create above is 15 meters east and 20 meters north (of the equator at >, the prime meridian). >, >, You can use the ol.proj package to get transform functions for geometries. >, >, // create a point in the Web Mercator CRS given longitude and latitude >, var geometry = new ol.geom.Point([15, 20]), >, geometry.transform(ol.proj.getTransform('EPSG:4326', 'EPSG:3857')), >, >, The EPSG:4326 and EPSG:3857 strings identify Geographic/WGS84 and Web >, Mercator coordinate reference systems. >, >, I can see a handful of ways this could be made more convenient. I'll >, create tickets for a couple of them now. >, >, Tim >, >, PS - Note that a slightly more convenient method for point geometries >, is to use the ol.proj.transform function. But this only works for >, point coordinates. >, >, var geometry = new ol.geom.Point(ol.proj.transform([15, 20], >, 'EPSG:4326', 'EPSG:3857')), >, >, >, >, >, On Thu, May 1, 2014 at 12:54 PM, Quintin Orsmond via OL3 Dev >, <, >, >, wrote: >,>, >,>, >,>, I am trying to add point features on a vector layer but for some reason the >,>, markers is always on the same place in this case on the Equator. >,>, >,>, var iconFeature = new ol.Feature({ >,>, geometry: new ol.geom.Point([15, 20]), //Point is not correctly drawn >,>, on the map >,>, name: 'Null Island', >,>, population: 4000, >,>, rainfall: 500 >,>, }), >,>, >,>, >,>, I used the Icon example, and here is a plunk , you can try to change the >,>, geometry of the iconFeature. >,>, >,>, So is this a bug or is there something that I am missing? >,>, >,>, Thanks. >,>, >,>, -- >,>, >,>, --- >,>, You received this message because you are subscribed to the Google Groups >,>, 'OL3 Dev' group. >,>, To unsubscribe from this group and stop receiving emails from it, send an >,>, email to Source.


Яндекс.Метрика Рейтинг@Mail.ru Free Web Counter
page counter
Last Modified: April 18, 2016 @ 2:08 pm