[OpenLayers-Users] vector doesn't display
Gery .
gamejihou at hotmail.com
Wed Dec 12 04:21:09 PST 2012
Hello,
I have some features in GeoJSON format I want to display, so I did this:
[code]
var vectorLayer = null;
var vectorStyle =
{
graphicName: 'square',
strokeColor: '#222',
fillColor: '#222'
};
var styleDefault = OpenLayers.Util.applyDefaults(
vectorStyle,
OpenLayers.Feature.Vector.style['default']
);
vectorLayer = new OpenLayers.Layer.Vector('search',
{
styleMap: new OpenLayers.StyleMap(
{
'default': styleDefault
}
),
displayInLayerSwitcher: true
}
);
[/code]
but they don't appear in the map, my question is if this is enough to get the features displayed or do I need something else there? if this is enough, I should think that this problem is about how the features are being read by OL. In fact, this doesn't work either:
var ll = new OpenLayers.LonLat(feature.geometry.x, feature.geometry.y);
mapPanel.map.setCenter(ll);
I get:
feature is not definedvar ll = new OpenLayers.LonLat(feature.geometry.x, feature.geometry.y);
why should this happen? thanks in advance
__________________________________________________________________________________________
Piensa en el medio ambiente - mantenlo en la pantalla. NO lo imprimas si NO es necesario.
Think green - keep it on the screen. Do NOT print if it is NOT necessary.
Denken Sie an die Umwelt - bewahren Sie es auf dem Bildschirm. Drucken Sie NICHT, wenn es NICHT notwendig ist.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20121212/63aee6d3/attachment.html>
More information about the Users
mailing list