[Featureserver] OpenLayers Rules and PostGIS Columns from FeatureServer

Mak Kolybabi mak.kolybabi at telenium.ca
Mon Aug 17 10:12:01 EDT 2009


I've blown a day or two now searching Google and fiddling with OpenLayers and
FeatureServer trying to get this to work, so I figure it's time to ask for help, again.

I have a table in PostGIS that I make available through FeatureServer. This table is
nothing special, just your regular the_geom and a few other columns. When I request this
table from FeatureServer as GeoRSS, all the other columns (type, name, etc.) are put in
<content>. When I request this same table as WFS, all the columns show up as tags in the
"fs" namespace.

Is there any format that FeatureServer produces that OpenLayers rules can select against
for formatting? For example, I would like each feature -- all are points -- to be a
different colour based on type, so I was trying things like:

var rule1 = new OpenLayers.Rule({
        filter: new OpenLayers.Filter.Comparison({
                type: OpenLayers.Filter.Comparison.EQUAL_TO,
                property: "type",
                value: "value1"
        }),
        symbolizer: {
                fillColor: "green"
        }
});

var rule2 = new OpenLayers.Rule({
        filter: new OpenLayers.Filter.Comparison({
                type: OpenLayers.Filter.Comparison.EQUAL_TO,
                property: "type",
                value: "value2"
        }),
        symbolizer: {
                fillColor: "red"
        }
});

var style = new OpenLayers.Style();
style.addRules([rule1, rule2]);

var style_map = new OpenLayers.StyleMap({
        "default": style,
        "select": style
});

var features = new OpenLayers.Layer.WFS(
        "Features",
        "featureserver/featureserver.py/feature_table?format=WFS", {
                styleMap: style_map
        });
map.addLayer(features);

But it would seem that OpenLayers can't gain access to the columns returned by
FeatureServer. Is there a specific format I have to request from FeatureServer to get
these rules to work? Or is my entire approach wrong?

--
Mak Kolybabi
Programmer
Telenium Inc.
204-957-2821
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/featureserver/attachments/20090817/8dcc2533/attachment.bin


More information about the Featureserver mailing list