[OpenLayers-Users] Google Popup feature layers

Burgholzer,Robert rwburgholzer at deq.virginia.gov
Fri Aug 31 08:39:38 EDT 2007


Rob,

I have begun some simple work towards allowing access to a php script
that interacts with a PostGIS database.  I originally conceived this as
a modification to the WFS-T layer to permit write access, since I use
mapserver as a WFS backend, which is read-only.

 

I think that the ultimate goal that I have is to make a SOAP wrapper to
the PostGIS database written in PHP.  So far though, I have not done so,
only created this hack to the code that allows writing.  It may serve as
a starting point for you however, the only coding that remains is to
make the PHP script respond to the SOAP request (so in short, all the
work remains to be done!!).

 

Anyhow, here is the code snippet from a previous posting.  This code
snippet shows how to enable writing a shape to a PostGIS table that is
created in OpenLayers user interface.  Hope this proves useful:

 

I managed to locate the following object "OpenLayers.Format.WKT" in the
very comprehensive library.  (I become more impressed with the
openlayers core libraries every day - kudos to whoever deserves them).
I followed your lead on this alternative format, and now it is working
quite nicely.

 

So, in my modified WFS.js, I have created a method that takes all
created shapes and places them in a POST array, which is then read by a
php script which has access to the PostGIS constructors for setting the
SRID(epsg), code follows:

 

Javascript: -->

        var wktObj = new OpenLayers.Format.WKT;

 

        for(var i=0; i<this.features.length; ++i) {

           var wktdata = wktObj.write(this.features[i]);

           pParams += "&WKTDATA[";

           pParams += i;

           pParams += "]=";

           pParams += wktdata;

          }

 

end Javascript: -->

 

BEGIN php: 

 

$wkt = $_POST['WKTDATA'];

#print_r($wkt);

$i = 2;

foreach ($wkt as $thiswkt) {

   $listobject->querystring = " insert into proj_features (gid, name,
the_geom) ";

   $listobject->querystring .= " select $i, 'test shape',
GeomFromText('$thiswkt', 4326) ";

   print("$listobject->querystring ");

   $listobject->performQuery();

   $i++;

}

 

END php

 

 

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/

Web-Based Water Supply Planning Demo:

http://soulswimmer.dynalias.net/models/wsdemo/demo_hsi.php

-----Original Message-----
From: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org]
On Behalf Of Rob Booth
Sent: Friday, August 31, 2007 7:50 AM
To: users at openlayers.org
Subject: [OpenLayers-Users] Google Popup feature layers

 

Hi

I've been using the Google-esque Popups (they're great!) but I have a
question.

My popup layer has over 17000 points, and when loaded as a Text layer,
this means that there is a significant load on the browser.  Is there an
effective way of using the Google popups via some kind of spatial
database, so that the requests can be spatially filtered at the server
side (by database or geoserver or something) 

MTIA

Rob

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20070831/7816b3d1/attachment.html


More information about the Users mailing list