Sorry I forgot to attach the file that I mentioned in my previous post.... I have named it as draw-feature2.html
Jatin Ambasana wrote: > > hey newbie... > > For drawing vector features..... > you can refer to > http://openlayers.org/dev/examples/draw-feature.html > http://openlayers.org/dev/examples/drag-feature.html > > To achieve the functionality you need you can follow any of 2 methods > mentioned below: > > 1)Change the following code in draw-feature.html: > > // This lets you call a function when a feature is inserted on vector > layer > var lineLayer = new OpenLayers.Layer.Vector("Line Layer",{onFeatureInsert: > featureIsAdded}); > > //Add this funtion in your code > function featureIsAdded(feature){ > alert("Feature with id: "+feature.id+", has following Geometry: > "+feature.geometry); > } > > I feel that would be sufficient for you...... > > 2)There is also another nice example but some what different that you can > see from: > http://openlayers.org/pipermail/users/2007-June/001998.html > http://openlayers.org/pipermail/users/2007-June/001998.html > > I have modified that code and I am attaching that with this post.... But > it has few problems.... It does show you the co-oridnates of all points of > the line drawn but it does not add the line to the Line Layer... > > I don't understand why it works in the previous standard OpenLayers > example and not in the second example that I downloaded from above > link...... > > If someone has solution for that then that would nice of him/her..... > > > newbie wrote: >> >> Dear All, >> I am using geoserver and managed to put a sample shapefile and >> able to view my simple map well. The problem now is that on top that map >> I want to add a layer where I can like draw polygon and capture the >> coordinates accordingly. How can I do this ? Thanks. >> > > http://n2.nabble.com/file/n2222990/draw-feature2.html draw-feature2.html -- View this message in context: http://n2.nabble.com/How-to-add-a-an-overlay-on-top-of-a-map--tp2196295p2222990.html Sent from the OpenLayers Users mailing list archive at Nabble.com. _______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users
