On Oct 18, 2010, at 9:55 AM, ext P Kishor wrote:

> On Mon, Oct 18, 2010 at 8:36 AM, David Fawcett <[email protected]> 
> wrote:
>> Puneet,
>> 
>> I know that you are using php and not Python,
> 
> Thanks David, but I am not using either PHP or Python. I am a Perl guy
> through and through. Never used anything else. But, that is not really
> relevant here.
> 
> I guess what I am looking for is access the to polygon that I just
> drew using the measure control. Obviously, it has been drawn on the
> map by OL. Surely it must be accessible somehow. I just can't figure
> out how.

What did you try? Did you look at the map and the layers in the map?

Everything in OpenLayers is accessible from the map object. 

> Looking at the GeoJSON example, it seems that if I have a GeoJSON
> object, I can create a poly out of it. So, putting the two together,
> it seems natural that if I could save my drawn poly as GeoJSON, I
> could draw it back out again at a later time.

Okay, so you got to GeoJSON, and you searched "geojson" in the OpenLayers
examples: 

  http://openlayers.org/dev/examples/?q=geojson

and found two:

  http://openlayers.org/dev/examples/geojson.html
  http://openlayers.org/dev/examples/vector-formats.html

Each of which shows reading from a GeoJSON object to create 
OpenLayers.Feature.Vector objects, and the latter of which shows a serialized
form of a geometry (as a GeoJSON string) when you hover over it.

And perhaps you looked at the Map object in firebug, and looked at the 
map.layers to see what was in there, and found the Vector layer that 
the control is drawing to. You looked at the Layer.Vector 
documentation:

  http://dev.openlayers.org/apidocs/files/OpenLayers/Layer/Vector-js.html

and saw that Vector Layers have a property features:
 
  
http://dev.openlayers.org/apidocs/files/OpenLayers/Layer/Vector-js.html#OpenLayers.Layer.Vector.features

which is an array of Feature.Vector objects:

  
http://dev.openlayers.org/apidocs/files/OpenLayers/Feature/Vector-js.html#OpenLayers.Feature.Vector

which have a geometry property:

  
http://dev.openlayers.org/apidocs/files/OpenLayers/Geometry-js.html#OpenLayers.Geometry

-- Chris_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to