[OpenLayers-Users] WFS layer from Mapserver not displaying

Alexandre Dube adube at mapgears.com
Thu May 12 12:36:39 EDT 2011


Hi,

   In your gml, you can see :
     xmlns:ms="http://mapserver.gis.umn.edu/mapserver"

   so try to set :

    var molleres = new OpenLayers.Layer.Vector("molleres", {
         strategies: [new OpenLayers.Strategy.BBOX()],
         protocol: new OpenLayers.Protocol.WFS({
             url:
"http://molleres/cgi-bin/mapserv?map=/var/www/molleres/application/maps/molleres.map",
             featureType: "molleres",
             featureNS: "http://mapserver.gis.umn.edu/mapserver"
         }),
         renderers: renderer
     });


   Does that help ?

Regards,

Alexandre

On 11-05-12 12:13 PM, tmartinh wrote:
> Hi all,
>
> I have been struggling to make the following setup work.
>
> Mapserver 5.6.6 + Postgis + Openlayers and trying to display a WFS layer
> with no success. Nothing gets rendered on the screen.
>
> Here is my configs:
>
> Mapfile
>
> MAP
>    NAME INSPECCIONS_REDUIT # Nom del mapa
>    STATUS ON
>    SIZE 600 600
>    EXTENT 521500 15000 556500 40000 # Extent del mapa
>    UNITS METERS
>    SHAPEPATH "data" # Carpeta o hi ha les dades SIG
>    IMAGECOLOR 255 255 255
>    IMAGETYPE PNG
>
>
> 	OUTPUTFORMAT # Format de sortida de la imatge
>    		NAME png
> 	  DRIVER "GD/PNG"
> 	  MIMETYPE "image/png"
> 	  IMAGEMODE RGB #PC256
> 	  EXTENSION "png"
> 	  FORMATOPTION "INTERLACE=OFF"
> 	END
>
>
>    # Projecci� corresponent a Andorra dsegons el codi EPSG: 27573
>
>     PROJECTION
>       "init=epsg:27573"
>     END
>
>    #
>    # Definici� de les dades WMS
>    #
>      WEB
> 	IMAGEPATH "/var/www/molleres/public/img/map/"
>    	IMAGEURL "/img/map/"
>
>      METADATA
>          "wfs_title"                  "WFS Demo Server for MapServer" ##
> REQUIRED
>          "wfs_onlineresource"
> "http://molleres/cgi-bin/mapserv?map=/var/www/molleres/application/maps/molleres.map"
> ## Recommended
>          "wfs_srs"                    "EPSG:27573" ## Recommended
>          "wfs_abstract"               "This text describes my WFS service."
> ## Recommended
>      END
>
>    END
>
>    SYMBOL
>      NAME 'circle'
>      TYPE ELLIPSE
>      POINTS 1 1 END
>      FILLED TRUE
>    END
>
>    SYMBOL
>      NAME 'rectangle'
>      TYPE HATCH
>      POINTS 1 1 END
>      FILLED TRUE
>    END
>
>    SYMBOL
>    NAME 'rectangle-train'
>    TYPE VECTOR
>    POINTS
>      0 0
>      0 0.6
>      1 0.6
>      1 0
>      0 0
>    END
>    FILLED TRUE
>    STYLE
>      8 12 8 12
>    END
> END
>
> # LEGEND object
> LEGEND
>    STATUS ON
>    KEYSIZE 18 12
>    # LABEL object
>    LABEL
>      TYPE BITMAP
>      SIZE MEDIUM
>      COLOR 0 0 89
>    END
>    #TEMPLATE "templates/legend.html"  ### HTML template file
> END
>
>
>
>
> ##################
> # molleres
> ##################
> LAYER
>    NAME "molleres"
>    METADATA
>      "wfs_title"             "Molleres" ##REQUIRED
>      "wfs_srs"               "EPSG:27573" ## REQUIRED
>      "gml_include_items"     "all" ## Optional (serves all attributes for
> layer)
>      "gml_featureid"         "gid" ## REQUIRED
>    END
>    TYPE POLYGON
>    STATUS ON
>    CONNECTIONTYPE POSTGIS
>    CONNECTION 'user=postgres password=*** dbname=molleres host=172.16.3.240
> port=5432'
>    DATA "the_geom from gis_schema.molleres_geom using SRID=27573 using unique
> gid"
>    PROJECTION
>      "init=epsg:27573"
>    END
>    DUMP TRUE             ## REQUIRED
>    CLASS
>        STYLE
>          COLOR 255 128 0
>          SYMBOL 'rectangle-train'
>          SIZE 10
>        END
>    END
> END #layer
>
>
> END # Map File
>
> Openlayers
>
> var molleres = new OpenLayers.Layer.Vector("molleres", {
>          strategies: [new OpenLayers.Strategy.BBOX()],
>          protocol: new OpenLayers.Protocol.WFS({
>              url:
> "http://molleres/cgi-bin/mapserv?map=/var/www/molleres/application/maps/molleres.map",
>              featureType: "molleres",
>              featureNS: "http://molleres"
>          }),
>          renderers: renderer
>      });
>
> Please note that this is an internal development server reason why URL is
> not compliant with W3C standards. (no .com or whatever)
>
> I have tried with several different options in my mapfile and openlayers but
> no success.
>
> Also find attached my server answer I got from firebug which looks fine.. I
> guess.
>
> <?xml version='1.0' encoding="ISO-8859-1" ?>
> <wfs:FeatureCollection
>     xmlns:ms="http://mapserver.gis.umn.edu/mapserver"
>     xmlns:wfs="http://www.opengis.net/wfs"
>     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.opengis.net/wfs/1.0.0/WFS-basic.xsd
>                         http://mapserver.gis.umn.edu/mapserver
> http://molleres/cgi-bin/mapserv?map=/var/www/molleres/application/maps/molleres.map&amp;SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=DescribeFeatureType&amp;TYPENAME=feature:molleres&amp;OUTPUTFORMAT=XMLSCHEMA">
>        <gml:boundedBy>
>        	<gml:Box srsName="EPSG:27573">
>        		<gml:coordinates>524801.051446,17249.106218
> 554734.725738,39483.294751</gml:coordinates>
>        	</gml:Box>
>        </gml:boundedBy>
>      <gml:featureMember>
>        <ms:molleres fid="molleres.1">
>          <gml:boundedBy>
>          	<gml:Box srsName="EPSG:27573">
>          		<gml:coordinates>540182.891043,20436.589901
> 540206.224092,20489.562228</gml:coordinates>
>          	</gml:Box>
>          </gml:boundedBy>
>          <ms:msGeometry>
>          <gml:Polygon srsName="EPSG:27573">
>            <gml:outerBoundaryIs>
>              <gml:LinearRing>
>                <gml:coordinates>540193.191218,20489.562228
> 540206.224092,20483.991726 540203.386289,20475.688524
> 540197.815786,20467.280218 540195.083086,20457.925977
> 540192.245283,20450.463606 540187.620715,20445.839037
> 540187.620715,20439.322600 540183.836977,20436.589901
> 540182.891043,20444.893103 540183.836977,20456.980043
> 540187.620715,20471.904786 540191.299349,20480.313092
> 540193.191218,20489.562228 540193.191218,20489.562228</gml:coordinates>
>              </gml:LinearRing>
>            </gml:outerBoundaryIs>
>          </gml:Polygon>
> ...
>
> Any help is really appreciated. I really don't know where to go further now.
>
> Best regards
>
> --
> View this message in context: http://osgeo-org.1803224.n2.nabble.com/WFS-layer-from-Mapserver-not-displaying-tp6356333p6356333.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users


-- 
Alexandre Dubé
Mapgears
www.mapgears.com



More information about the Users mailing list