[OpenLayers-Users] GeoJSON and SelectFeature control

Adorian Ardelean mynature at gmail.com
Fri Oct 31 13:14:00 EDT 2008


Hi,

I am trying to link a SelectFeature control to a dynamically loaded GeoJSON
layer. I would like to serialize features drawn in this layer, but it seems
that SelectFeature control does not work for me. Hover effect does not show
either. Features from JSON layer are polygons.

I would like to know if it is possible to use SelectFeature control with a
GeoJSON layer.

All the best,
Adorian


If helpful for reply, here are bits of code I use. For control:
var regioninfo = new OpenLayers.Control.SelectFeature(regions, {hover: true,
onSelect: getregioninfo});
map.addControl(regioninfo);
regioninfo.activate();

where regions is GeoJSON layer and getregioninfo is the function that will
serialize the feature.

For  creating and reloading the layer GeoJSON I use:
var regions = new OpenLayers.Layer.Vector("regions",{format:
OpenLayers.Format.GeoJSON});
OpenLayers.loadURL(url, {}, null, onloadjson, onloadfailedjson);

-- 
Dr. Adorian Ardelean
coordinator of myNature Project

http://mybiosis.info/nature/portal.php?pagename=firstpage [a Romanian
biodiversity-database]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20081031/6fe22423/attachment.html


More information about the Users mailing list