[OpenLayers-Users] Problem with polygon layer

Arnd Wippermann arnd.wippermann at web.de
Mon Jun 17 13:57:06 PDT 2013


There is a format option "ignoreExtraDims".

OpenLayers.Format.GeoJSON = OpenLayers.Class(OpenLayers.Format.JSON, {

    /**
     * APIProperty: ignoreExtraDims
     * {Boolean} Ignore dimensions higher than 2 when reading geometry
     * coordinates.
     */ 
    ignoreExtraDims: false,


with set to true the geojson file will show up as expected:

var polygon_layer = new OpenLayers.Layer.Vector("Polygon Test", {
    strategies: [new OpenLayers.Strategy.Fixed()],
    protocol: new OpenLayers.Protocol.HTTP({
        url: "zoning_3857.geojson",
        format: new OpenLayers.Format.GeoJSON({extractStyles: false ,
extractAttributes: true, ignoreExtraDims:true})
    })
});
map.addLayer(polygon_layer);


Arnd 


-----Ursprüngliche Nachricht-----
Von: openlayers-users-bounces at lists.osgeo.org
[mailto:openlayers-users-bounces at lists.osgeo.org] Im Auftrag von boesiii
Gesendet: Montag, 17. Juni 2013 21:51
An: openlayers-users at lists.osgeo.org
Betreff: Re: [OpenLayers-Users] Problem with polygon layer

I figured out my problem.  In the GeoJSON file my coordinates were in XYZ
format (see below) once I removed the Z cooridinate value everything worked
fine.

[ -8932119.2363246344, 4964545.5571182314, 0.0 ]

Why did Openlayers not display my GeoJSON file when the file was in 3d
format?



--
View this message in context:
http://osgeo-org.1560.x6.nabble.com/Problem-with-polygon-layer-tp5060684p506
0697.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
Users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users



More information about the Users mailing list