[OpenLayers-Users] Trying to draw a box on a map, and get the coordinates back.

Jtrsmith jtrsmith at gmail.com
Thu Jan 7 11:27:06 EST 2010


i am not sure i explained what i was looking for correctly. here is an
example.

vectors.events.register('featureadded', vectors, findcoords);
function findcoords (feature) {
     var vertices = feature.geometry.getVertices();
     document.getElementById('output').value = 'ID:' + vertices;
}

the event does actually trigger, however, feature.geometry.getVertices()
does not work.

i am using geojson to display other polygons on the map, and would like the
variable vertices to get the coordinates of the polygon vertices so that i
can add a new polygon to the map and save the coordinates in a database.

John


micklesh wrote:
> 
> Hi, John.
> if i understood your requirements, there is an example in the docs
> http://dev.openlayers.org/docs/files/OpenLayers/Control-js.html
> 
> regards, michael.
> 
> 2010/1/4 John Smith <jtrsmith at gmail.com>
> 
>> i just saw this post and was wondering if the solution was ever found. i
>> am
>> basically trying to do the same thing. I need to draw a box around an
>> area
>> of my map and show the coordinates in a form field, so i can post the
>> coordinates and a description to my database.
>>
>> _______________________________________________
>> 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://n2.nabble.com/Trying-to-draw-a-box-on-a-map-and-get-the-coordinates-back-tp4251287p4267311.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.



More information about the Users mailing list