[OpenLayers-Users] displaying Features

Keith kweber at archetypecorp.com
Tue Mar 6 16:46:40 EST 2007


I've been playing around with the feature object, but I can't get the marker
attribute to display on the map.

 

I suspect that this is because I don't know the correct method for adding a
feature to a layer.  This seems like a trivial problem, but I haven't found
a function that straight up adds a feature to the layer.  I have included a
"dumbed-down" version of the code I'm working with below.

 

I'm hoping to use the feature as the object in the event register call, so
that I can access its attributes doing the mousedown event.  I'd be very
appreciative if someone can clue me into how to accomplish this.

 

Am I missing anything else?

 

 

Code:

<!----------------------------------------------------------------------->

 

function addFeature(layer,lonlat,data) {

                                                                

            newFeature = new OpenLayers.Feature(layer,lonlat,data);

            

            newFeature.marker = new OpenLayers.Marker(lonlat,

                                    new
OpenLayers.Icon("/kamap/mapserver/images/AQUA.png",new
OpenLayers.Size(20,34)));

 

            newFeature.marker.size = new OpenLayers.Size(20,34);

                                                            

            newFeature.marker.events.register("mousedown", newFeature,
mousedown);

    }

 

                        

<!----------------------------------------------------------------------->

 

function mousedown(evt) {

 


document.write("____DEBUG LINE : "     +    this.layer );

document.write("____DEBUG LINE : "     +    this.lonlat );

document.write("____DEBUG LINE : "     +    this.data );

                                   

}

 

<!---------------------------------------------------------------------->

 

 

 

 

Thanks,

 

Keith Weber
Tech Support
Archetype, Inc.
205.443.6560 office
334.669.2522 mobile
kweber at archetypecorp.com

 

 


The information transmitted is the property of Archetype, Inc. and is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Statements and opinions expressed in this e-mail may not represent those of the company.  Any review, retransmission, dissemination and other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender immediately and delete the material from any computer. E-mail transmission cannot be guaranteed to be secured or error-free as information could be intercepted, corrupted, lost, destroyed, received late or incomplete, or could contain viruses. The sender therefore does not accept liability for any error or omission in the contents of this message, which arises as a result of e-mail transmission.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20070306/e480e07d/attachment.html


More information about the Users mailing list