[Featureserver] Windows install - next step
Andrew de Klerk
andrew.deklerk at gmail.com
Wed Jul 30 14:09:03 EDT 2008
Hi
My FS is working perfectly on IIS. I have setup a Postgres layer and
successfully loaded it through FS onto an openlayers map. I have then
"hacked" the wfs-t example from openlayers to start working on feature
editing. This is what I have so far:
--------------- JS -----------------------
var mainmap = new OpenLayers.Layer.WMS( "WMS",
"http://localhost/wms/streetmap.asp",
{layers: 'StreetMap'},
{'buffer': 0,'isBaseLayer': true,'gutter':
10,'displayInLayerSwitcher':true,'attribution': 'Test'}
);
//2. postgis WFS layers (with a different style than default)
var wfsGeofence = new OpenLayers.Layer.WFS("LocateX Geofence (postgis)",
"featureserver.cgi/LocateX_Geofence/all.gml",
{maxfeatures: "300"}, {extractAttributes: true, displayInLayerSwitcher:
true});
wfsGeofence.style = {fillColor:'#FF0000', fillOpacity: 0.2, strokeColor:
"#FF0000", strokeOpacity: 1, strokeWidth: 2};
wfsGeofence.onFeatureInsert=function(feature) { feature.style.strokeColor =
"#ff0000"; feature.layer.drawFeature(feature); }
//add the layers to the map
map.addLayers([wfsGeofence, mainmap]);
//add map controls
map.addControl(new OpenLayers.Control.Navigation());
map.addControl(new OpenLayers.Control.PanZoomBar());
map.addControl(new OpenLayers.Control.MousePosition());
map.addControl(new OpenLayers.Control.LayerSwitcher());
// ###TOOLBARS
var zb = new OpenLayers.Control.ZoomBox({title: "Zoom Box: Selecting it you
can zoom on an area by clicking and draging"});
var panel = new OpenLayers.Control.Panel({div:$('panel'),defaultControl:
zb,'displayClass': 'olControlPanel'});
// Add a multi-point polygon drawing tool tip container
var dply = new OpenLayers.Control.DrawFeature(wfsGeofence,
OpenLayers.Handler.Polygon,{handlerOptions: {'freehand': false},
'displayClass': 'olControlDrawFeaturePolygon'});
dply.featureAdded = function(feature) {
feature.state = OpenLayers.State.INSERT;
feature.style['strokeColor'] = "#ff0000";
feature.style['fillColor'] = "#ff0000";
feature.style['fillOpacity'] = 0.2;
feature.style['strokeWidth'] = 2;
feature.style['strokeOpacity'] = 1;
feature.layer.drawFeature(feature);
}
panel.addControls([ new OpenLayers.Control.ZoomToMaxExtent(),new
OpenLayers.Control.Navigation(), zb,dply ]);
//add panel to map
map.addControl(panel);
//set map center
map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
--------------- JS -----------------------
--------------- HTML -----------------------
<a href="#" onclick="map.layers[0].commit();return false">Save
Geofence</a><br />
<div id="panel" class="olControlPanel"></div>
<div id="map"></div>
--------------- HTML -----------------------
I add a new feature fine, and can see it. When I hit the save Geofence link,
It just polls until timeout. In firebug I can see the that it is sending the
correct information (I,e the gml of the new feature I just added)
Can anyone spot anything obvious that I am missing. I must add that I have
not added the simplejson addon to python yet as I have not found any windows
binaries for it, but I am using gml, so gdal should handle it (correct???)
I am really hacking away here, so again pls ignore my ignorance J
Thanks
Andrew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/featureserver/attachments/20080730/7a2d2fa6/attachment.html
More information about the Featureserver
mailing list