[OpenLayers-Users] draw Polygon from script

Kevin Kempfer mail at kevinkempfer.de
Tue Sep 11 08:55:37 EDT 2007


What I am doing so far is this:

var p1 = new OpenLayers.Geometry.Point(8.4,41.3)
var p2 = new OpenLayers.Geometry.Point(8.4,42.3)
var p3 = new OpenLayers.Geometry.Point(9.4,42.3)
var p4 = new OpenLayers.Geometry.Point(9.4,41.3)

var poly = new OpenLayers.Geometry.LinearRing(new Array(p1,p2,p3,p4));
var control = drawControls['polygon'];
control.drawFeature(poly);

Is this the correct way of adding a polygon to the map?

Thanks,

Kevin.


Kevin Kempfer schrieb:
> Hi,
> 
> I receive some points from a database via AJAX and would like to add 
> them to the map as new polygon. Where should my script jump in? Call the 
> DrawFeature-Handler? Can someone please give me a direction on where to 
> start?
> 
> Thanks,
> 
> Kevin.
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users

-- 
http://www.kevinkempfer.de
Tel.: (07071) 860303
ICQ:  2186573
Skype: kevin0815

Plannung bedeutet, den Zufall durch den Irrtum zu ersetzen.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3249 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.osgeo.org/pipermail/openlayers-users/attachments/20070911/0760d69b/smime.bin


More information about the Users mailing list