[OpenLayers-Users] setting WKT returned from postGIS in form
fieldto openlayers feature
Burgholzer,Robert
rwburgholzer at deq.virginia.gov
Fri Oct 31 13:37:23 EDT 2008
Eric, thanks, you beat me to the posting. I realized that I was basing
my work on a tutorial from an older version of openlayers, since the new
method returns a feature, rather than a geometry, it works simple, and
much more directly.
The functioning code is quite simple:
function setScratchShape(WKTgeom) {
// assumes that vlayer is set in globals
var wktObj = new OpenLayers.Format.WKT;
var wktfeatures = wktObj.read(WKTgeom);
vlayer.addFeatures(wktfeatures);
vlayer.redraw();
}
r.b.
Robert W. Burgholzer
Surface Water Modeler
Office of Water Supply and Planning
Virginia Department of Environmental Quality
rwburgholzer at deq.virginia.gov
804-698-4405
Open Source Modeling Tools:
http://sourceforge.net/projects/npsource/
-----Original Message-----
From: Burgholzer,Robert
Sent: Friday, October 31, 2008 11:53 AM
To: Burgholzer,Robert; users at openlayers.org
Subject: RE: [OpenLayers-Users] setting WKT returned from postGIS in
form fieldto openlayers feature
I forgot to give the openlayers error:
Error: feature.geometry.getBounds is not a function
Source File:
http://172.16.209.70/html/devlib/OpenLayers-2.7/OpenLayers.js
Line: 325
Robert W. Burgholzer
Surface Water Modeler
Office of Water Supply and Planning
Virginia Department of Environmental Quality
rwburgholzer at deq.virginia.gov
804-698-4405
Open Source Modeling Tools:
http://sourceforge.net/projects/npsource/
-----Original Message-----
From: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org]
On Behalf Of Burgholzer,Robert
Sent: Friday, October 31, 2008 11:51 AM
To: users at openlayers.org
Subject: [OpenLayers-Users] setting WKT returned from postGIS in form
fieldto openlayers feature
My application returns a WKT representation of an element geometry in a
hidden form field. I am trying to take that geometry and push it into
an openlayers feature layer, so that as the user goes views different
elements from the PG server, those features appear in the foreground on
the OL map.
I have tried to implement some code from the WKT example, but I am not
having any luck. The feature fails to draw, although I know it is
there, because I have been using an alert() to show me the contents of
the WKT string. Thus, I am guessing that somehow my format returned
from PostGIS is incorrect. Here is the contents of my hidden form
field:
MULTIPOLYGON(((-8623549.09290489 4522549.65191948,-8623596.86604756
4522931.83706085,-8623635.0845617 4523629.32494386,-8624131.92524548
4523591.10642972,-8624619.21130074 4523619.77031532,-8625488.68249736
4523610.21568679,-8626224.3888945 4523552.88791558,-8626319.93517984
4523552.88791558,-8626597.01940734 4523849.08140015,-8626721.22957829
4524040.17397083,-8627256.28877621 4523973.2915711,-8627390.05357569
4523954.18231403,-8627409.16283276 4523715.31660067,-8627447.38134689
4523581.55180119,-8627265.84340474 4523266.24905955,-8627208.51563353
4523103.82037447,-8626979.20454871 4522884.06391818,-8626616.12866441
4522759.85374724,-8626052.40558088 4522654.75283335,-8625555.5648971
4522444.5510056,-8625240.26215547 4522243.90380638,-8625058.72421331
4522463.66026267,-8624724.31221461 4522501.87877681,-8624514.11038686
4522406.33249147,-8624237.02615936 4522234.34917785,-8623959.94193187
4522234.34917785,-8623644.63919024 4522282.12232052,-8623549.09290489
4522549.65191948))
Any help would be most appreciated,
r.b.
Robert W. Burgholzer
Surface Water Modeler
Office of Water Supply and Planning
Virginia Department of Environmental Quality
rwburgholzer at deq.virginia.gov
804-698-4405
Open Source Modeling Tools:
http://sourceforge.net/projects/npsource/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20081031/17276265/attachment.html
More information about the Users
mailing list