I have looked into this a little more, however i still cannot get it to work.
everthing works as far as the map is concerned. but my link to locate the
feature is not working.

here is what i have so far:

        var map, layer;
                function init(){
                        map = new OpenLayers.Map( 'map' );
                        layer = new OpenLayers.Layer.WMS( "OpenLayers WMS", 
                                "http://labs.metacarta.com/wms/vmap0";,
                                {layers: 'basic'} );
                        map.addLayer(layer);
                        var featurecollection = {
                                "type": "FeatureCollection",
                                "features": [{
                                        "type":"Feature",
                                        "id":"testspot",
                                        "geometry":{
                                                "type":"Polygon",
                                                
"coordinates":[[[11.458333333332998, 1.1458333333333],
[11.677830186049317, 1.7943613837737755], [11.793172529640314,
2.46924185047542], [11.801520252807485, 3.1538569365481837],
[11.702667806901953, 3.831349146465749], [11.49904926721437,
4.485036373552212], [11.19567839796303, 5.0988226688131775],
[10.800025196779098, 5.657594576619394], [10.32183195857341,
6.147593278143032], [9.772873387902962, 6.556753379140124],
[9.1666666666667, 6.874999999999599], [8.518138616226224,
7.094496852715918], [7.843258149524581, 7.209839196306914],
[7.158643063451817, 7.218186919474086], [6.481150853534252,
7.1193344735685535], [5.827463626447789, 6.9157159338809695],
[5.213677331186824, 6.612345064629631], [4.654905423380606,
6.216691863445699], [4.164906721856969, 5.738498625240011],
[3.7557466208598758, 5.189540054569562], [3.4375000000004006,
4.583333333333301], [3.218003147284082, 3.9348052828928255],
[3.1026608036930865, 3.259924816191183], [3.0943130805259136,
2.5753097301184176], [3.1931655264314465, 1.897817520200852],
[3.3967840661190305, 1.2441302931143896], [3.700154935370368,
0.6303439978534247], [4.095808136554301, 0.07157209004720722],
[4.574001374759988, -0.418426611476431], [5.1229599454304395,
-0.8275867124735243], [5.729166666666701, -1.145833333333],
[6.377694717107175, -1.3653301860493183], [7.052575183808821,
-1.480672529640314], [7.737190269881584, -1.4890202528074852],
[8.414682479799149, -1.3901678069019532], [9.068369706885612,
-1.1865492672143692], [9.682156002146577, -0.8831783979630305],
[10.240927909952793, -0.48752519677909767], [10.730926611476432,
-0.00933195857340996], [11.140086712473524, 0.5396266120970394],
[11.458333333332998, 1.1458333333333]]]
                                        }
                                }]
                        };
                        
                        var geojson_format = new OpenLayers.Format.GeoJSON();
                        var vector_layer = new OpenLayers.Layer.Vector(); 
           vector_layer.addFeatures(geojson_format.read(featurecollection));
                   map.addLayer(vector_layer);
           selectCtrl = new OpenLayers.Control.SelectFeature( vector_layer,
                {clickout: true}
            );
            map.addControl(selectCtrl);
            selectCtrl.activate();
                        map.zoomToMaxExtent();
                        map.setCenter(new OpenLayers.LonLat(0, 0), 0);
                }
    

Link to the right of map using onClick: 
onclick="selectCtrl.select('testspot')"> Locate Testspot
 



Any ideas?
-- 
View this message in context: 
http://n2.nabble.com/Select-geojson-feature-from-hyperlink-tp4385578p4461984.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
Users@openlayers.org
http://openlayers.org/mailman/listinfo/users

Reply via email to