[Featureserver] Help with FeatureServer , OpenLayers and PostGIS
Tom A. Cox
tomc at hot.rr.com
Wed Sep 7 10:39:35 EDT 2011
Gabriel,
I haven't done a lot of work with Featureserver/OpenLayers and I haven't used
WMS at all, but I have a basic mapping system I worked on last year using WFS.
Hope this info helps.
My featureserver.cfg file is similar to yours. The OpenLayers interface uses
WFS. So...
featureserver.cfg:
[frontload]
type=PostGIS
dsn=host=localhost dbname=gis user=tomc password=
layer=frontload
fid=fid
geometry=way
srid=4326
attribute_cols=service_ref,service_num,service_name,street_num,street_name,city,state,zipcode,container_type,serial_number,begin_date,status
index.html script section:
var cgi_url = "/cgi-bin/featureserver.cgi";
wfs_frontload = new OpenLayers.Layer.WFS(
"Frontload",
cgi_url + "/frontload?format=WFS",
{maxfeatures: max_features},
{extractAttributes: true, displayInLayerSwitcher: true,
visibility: false, styleMap: map_styles,
projection: new OpenLayers.Projection("EPSG:4326")}
);
OpenStreetMap.js, OpenLayers.Layer.OSM.Mapnik function modified for base url.
You may not need this if you are using a standard directory layout or for WMS.
On Tuesday 06 September 2011 3:19:00 pm Gabriel ODUORI wrote:
> Hi,
>
> I am working on my thesis and i am somehow stuck. I have a PostGIS database
> up and running and have included sone tables in a configuration file that i
> would like to be read and loaded on open layers.
>
> My cinfiguration looks like this
>
>
> [Primary_canal]
> type=PostGIS
> dsn=host=localhost dbname=Project user=postgres password=gabbs
> layer=Primary_canal
> fid=gid #defaults to ogc_fid
> geometry=the_geom # defaults to the_geom
> srid=4326 #defaults to 4326
> attribute_cols=name,barragenam #optional
> order=name #optional
>
> I am looking for a way to have my layers served to open layers through a
> method like this example from GeoServer.
>
> new OpenLayers.Layer.WMS("Cities",
> "http://demo.opengeo.org/geoserver/wms", { ## I would
> like this line to point to my table in the featureserver.cgi file
> layers: "topp:tasmania_cities",
> transparent: true,
> format: "image/gif"
> }, {
> isBaseLayer: false,
> buffer: 0
> Many thanks,
>
> Gabriel.
--
Tom A. Cox
IntelliSystems
Systems Analyst and Consultant
Office: 254-848-5598 Email: Tom Cox <tomc at hot.rr.com>
More information about the Featureserver
mailing list