I'm trying to set up what I believe is a fairly straightforward system but
can't see how to make it work, checked docs, and many examples but it's just
not doing what I need.

Desired End Result: A map with point features from my customer built php
server that have labels with the name of the feature. I have complete
control over the client side and the server side of this one (looking for
the simplest way to do this) - at some point in the future I'd like to
extend this to read additional attribute data to display a pop-up on click
and perhaps also show things other then just points - but for now I'm just
trying to get this to work.

Here is what my server is putting out:

<wfs:FeatureCollection xmlns:wfs="http://www.opengis.net/wfs";
                    xmlns:xde="http://www.example.com/myns";
                    xmlns:gml="http://www.opengis.net/gml";
                    xmlns:ogc="http://www.opengis.net/ogc";
                    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
                    xsi:schemaLocation="http://www.opengis.net/wfs
http://schemas.opengeospatial.net//wfs/1.0.0/WFS-basic.xsd";>
<gml:boundedBy>
<gml:Box srsName="http://www.opengis.net/gml/srs/epsg.xml#4326";>
<gml:coordinates decimal="." cs="," ts=" ">

                   
-124.58021460938,48.783354492188,-122.93226539062,50.156645507812
                    
</gml:coordinates>
</gml:Box>
</gml:boundedBy>
<gml:featureMember>
<xde:asset fid="asset.71">
<xde:name>Alberni Responder</xde:name>
<xde:geometry>
<gml:Point srsName="http://www.opengis.net/gml/srs/epsg.xml#4326";>
<gml:coordinates>-124.812,49.2443</gml:coordinates>
</gml:Point>
</xde:geometry>
</xde:asset>
</gml:featureMember>

etc...
</wfs:FeatureCollection>


And here is my OL config:


function init(){
            var lat = 49.47;
            var lon = -123.75624
            OpenLayers.IMAGE_RELOAD_ATTEMPTS = 4;
            OpenLayers.Util.onImageLoadErrorColor = "transparent";
            options = {resolutions:[1.40625, 0.3515625, 0.087890625,
0.02197265625, 0.0054931640625, 0.00274658203125, 0.001373291015625,
0.0006866455078125, 0.00034332275390625, 0.000171661376953125,
8.58306884765625e-05, 4.291534423828125e-05],
                       projection:"EPSG:4326",
                       controls: []};
            map = new OpenLayers.Map( 'map',options );
            layer = new OpenLayers.Layer.WMS( <approperiate layer options
here - this works fine>);

            mywfs = new OpenLayers.Layer.Vector("Features", {
                    strategies: [new OpenLayers.Strategy.BBOX()],
                    styleMap: new OpenLayers.StyleMap({fillColor: "#ff0000",
                                                       strokeColor:
"#990000",
                                                       strokeWidth: 1,
                                                       fillOpacity: 0.9,
                                                       pointRadius: 5,
                                                       label: "${name}"
                                                      }),
                    protocol: new OpenLayers.Protocol.HTTP({url:
"http://<path to my php here>",
                                                            params: {
                                                                format:
"WFS",
                                                                service:
"assets",
                                                                request:
"GetFeatures",
                                                                srs:
"EPSG:4326",
                                                                maxfeatures:
50
                                                            },
                                                            format: new
OpenLayers.Format.GML({featurePrefix:'xde',
                                                                                
             
featureName: 'xde:asset',
                                                                                
             
extractAttributes: true}),
                                                        })
                });
            map.addLayers([layer,mywfs]);


The resulting map shows the features but no labels and seems to completely
disregard my attempt to style them. If anyone can see what I'm doing wrong,
point me to a similar example, or suggest a better method I'd be very
appreciative.


-- 
View this message in context: 
http://osgeo-org.1803224.n2.nabble.com/Example-for-WFS-setup-trying-to-get-labels-from-feature-attrs-tp5745474p5745474.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to