Timeline for Loading features incrementally in a vector layer
Current License: CC BY-SA 3.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 3, 2012 at 3:20 | comment | added | drnextgis | Yes, only for EPSG:4326 and EPSG:900913 and their equivalents. Otherwise you should use proj4js library trac.osgeo.org/proj4js | |
Aug 2, 2012 at 11:37 | comment | added | Sergio | I see, so the extra step of declaring the format object with internal and external projections was only necessary because we are adding layers manually. If I understood correctly, in my original code that step was not necessary since when setting the projection property of the layer (with "projection: new OpenLayers.Projection("EPSG:4326")"), I am explicitly saying that the expected features are in the "EPSG:4326" projection, then behind the curtains those features will be transformed to the projection of the map ("EPSG:900913"), correct? | |
Aug 2, 2012 at 9:13 | comment | added | drnextgis | Yes, you are correct. Note that even if you set the projection object on a layer, if you are adding features to the layer manually (via layer.addFeatures), they must be transformed before adding to the layer. OpenLayers will only transform the projection of geometries that are created internally to the library, to prevent duplicating projection work. docs.openlayers.org/library/spherical_mercator.html | |
Aug 2, 2012 at 9:04 | comment | added | Sergio | Thanks for your answer @drnextgis!, one question about the projections: In my example, when I instantiated the vector layer, I added in its properties:"projection: new OpenLayers.Projection("EPSG:4326")" Is this correct considering it is loading OSM data?, or should I had specified the same projection I declared for the map (EPSG:900913)? or rather should I had declared the osm format object as you did in your example (specifying internal and external projections)?. Thanks for any clarification, the projection details are breaking my head now. By default the OSM data is in EPSG:4326, isn't it? | |
Aug 2, 2012 at 8:53 | vote | accept | Sergio | ||
Aug 2, 2012 at 2:08 | history | answered | drnextgis | CC BY-SA 3.0 |