[OpenLayers-Users] How to add a an overlay on top of a map?

newbie shai_mus at hotmail.com
Tue Jan 27 11:33:03 EST 2009


Dear Jatin,
             Thank you for your help. I really appreciate it. I try to edit
your code and added this one below. But unfortunately the map didnt appear.
I have managed to get the drawing and also once I click i can see the points
coordinate but have u managed to why the line not stay? So what I am also
curious incase I make a mistake in my drawing can I edit or erase it ? My
next step I want to save this coordinate into my database how do you suggest
? Thanks.
var wmsLayer = new OpenLayers.Layer.WMS(
                    "topp:penang_polyline - Tiled",
"http://localhost:8080/geoserver/wms",
                    {
                        layers: 'topp:penang_polyline',
                        styles: '',
                        height: '550',
                        width: '502',
                        srs: 'EPSG:4326',
                        
                        
                        tilesOrigin : "100.3178548,5.3952127999237645"
                    },
                    {buffer: 0} 
                );

Jatin Ambasana wrote:
> 
> 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--tp2196295p2226702.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list