[Featureserver] OpenLayers Rules and PostGIS Columns from FeatureServer

Josh Livni josh at umbrellaconsulting.com
Mon Aug 17 10:48:38 EDT 2009


I'd personally recommend geojson output from FeatureServer.  The extra
values/columns will show up under 'properties' for each feature, and you can
access those from OL no problem - try google geojson stylemap for some
examples (i assume) or ask again if you get stuck.

 -Josh


On Mon, Aug 17, 2009 at 7:12 AM, Mak Kolybabi <mak.kolybabi at telenium.ca>wrote:

> 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
>
> _______________________________________________
> Featureserver mailing list
> Featureserver at openlayers.org
> http://featureserver.org/mailman/listinfo/featureserver
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/featureserver/attachments/20090817/d5b19b22/attachment.html


More information about the Featureserver mailing list