[OpenLayers-Users] Best strategy to add many clickable rectangle areas?

darrepac pascal.darre at laposte.net
Tue Oct 14 17:31:41 EDT 2008


Hi Arnd,

Thanks for your help.
I have setup correctly 2 rectangle areas within a GML file but I cannot make
it work. Questions:
- where do I put the attribute with the name in the GML?? Here is an extract
of my gML:

<gml:featureMember>
    <attribute name="http://www.google.com" />
      <ms:polygon fid="1">
        <gml:polygonMember>
          <gml:Polygon srsName="EPSG:4326">
            <gml:outerBoundaryIs>
              <gml:LinearRing>
                <gml:coordinates>2.71113144,41.73139136
2.39768263,41.73139136 2.39768263,41.55005677 2.71113144,41.55005677
2.71113144,41.73139136 </gml:coordinates>
              </gml:LinearRing>
            </gml:outerBoundaryIs>
            
          </gml:Polygon>
        </gml:polygonMember>
        <ms:ogc_fid>1</ms:ogc_fid>
        <ms:name>http://www.yahoo.com</ms:name>
        <ms:id>0</ms:id>
      </ms:polygon>
    </gml:featureMember> 

- I presume that your function has to be put outside the initial load
function?


Thanks!



Arnd Wippermann wrote:
> 
> If you work with features coming from wfs, gml, kml, etc., then you can
> register 'featureselected' for the vector layer. 
> 
> If the source of the features have an attribute with the specific url, you
> can retrieve the url from the feature and execute your function.
> 
> var aktLayer = 1; //index of a vectorlayer
> map.layers[aktLayer].events.register('featureselected',
> map.layers[aktLayer], regFeatureSelected);
> 
> function regFeatureSelected()
> {
>     var objF = this.selectedFeatures[0];
> 
>     theUrl = objF.attributes['name'] ? objF.attributes['name'] :
> "http://www.google.de";
> 
>     window.open(theUrl);
> }
> 
> Arnd Wippermann
>  
> 
> -----Ursprüngliche Nachricht-----
> Von: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] Im
> Auftrag von darrepac
> Gesendet: Dienstag, 14. Oktober 2008 17:45
> An: users at openlayers.org
> Betreff: [OpenLayers-Users] Best strategy to add many clickable rectangle
> areas?
> 
> 
> Hello,
> 
> New to openlayers, I am starting to put my hands on it. I have seen how
> powerful openlayers is, which also make feel a little bit lost in front of
> so much and deep functionalities. I require your experience to oriente me
> in
> the things I am trying to do.
> 
> I would like to have many rectangles area (about 100) which will delimit
> some geographical area and which will be clickable by the user to activate
> dedicate and specific URL (the rectangle could only be a box or a
> semi-transparent filled color).
> 
> I don't know what is the best system for doing so. So far I have seen the
> boxes example (but also a non answered question related to my needs here:
> http://www.nabble.com/Box-Click-Event-to13782689.html), I have seen that
> we
> can overlayed GML where you can define rectangle (but not sure if we can
> assign unique URL for each one?)... may-be other solution?
> 
> Thanks for your thoughts.
> --
> View this message in context:
> http://www.nabble.com/Best-strategy-to-add-many-clickable-rectangle-areas--t
> p19975759p19975759.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> 
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
> 
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
> 
> 

-- 
View this message in context: http://www.nabble.com/Best-strategy-to-add-many-clickable-rectangle-areas--tp19975759p19982630.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list