[OpenLayers-Users] Vector layer renders features joined together...

Robert Connolly r.connolly at auckland.ac.nz
Thu Mar 26 21:35:54 EDT 2009


Hi All,

 

I'm rendering a group of features in a vector layer, the rendering seems
to be successful, however all the polygons are joined together by lines
for some reason, here's the code I used to do the rendering:

 

var geojson_format = new OpenLayers.Format.GeoJSON();

var styleMap = new
OpenLayers.StyleMap(OpenLayers.Util.applyDefaults({fillColor:
fill_colour, fillOpacity: 0.8, strokeColor: stroke_colour},
OpenLayers.Feature.Vector.style["default"]));

var vector_layer2 = new OpenLayers.Layer.Vector(catname+' (Areas)',
{styleMap: styleMap}); 

map.addLayer(vector_layer2);

features = geojson_format.read(data);

for(var i in features)

{

               var feature = features[i];

               if(feature != null)

               {

                              feature.geometry.transform(new
OpenLayers.Projection("EPSG:4326"), new
OpenLayers.Projection("EPSG:900913"));

               }

}

vector_layer2.addFeatures(features);

 

You can see the affect at: http://www.chsrp.org.nz/geomap/ (takes a
while to load, my code isn't particularly optimised yet and there's
quite a lot of data).

 

Hope someone can help,

 

Cheers,

 

Rob Connolly

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20090327/106093a4/attachment.html


More information about the Users mailing list