[OpenLayers-Users] trouble with WFS and Mapserver - Partially solved

Burgholzer,Robert rwburgholzer at deq.virginia.gov
Fri Sep 28 15:42:57 EDT 2007


Hmm. It seems that every solution finds a new problem.  I managed to discern my trouble - it had to do with URL location.

 

I am testing my application and WFS server all on my local workstation.  The issue, after straightening out the baseLayer and projection trouble, came from the location of my script, where I was using a 172.16. notation to access it, and the location of the WFS server, which I was calling as "localhost".  Thus, a proxy, or consistent URL scheme was required.  I initally ran into the trouble because my script was freezing my browser, and blowing up memory requirements, so I tried "localhost" as my WFS location, and everything sped up, but of course, nothing appeared, because I would have needed a proxy setting.  But, the trouble really stemmed from the fact that my shapes are too complex, I suppose.  There are 250 shapes in my layer, and that is choking everything up.  They are relatively complicated county boundaries.  If I set "maxfeatures: 10" in my request, things go faster, and the shapes are rendered in about 30 seconds.  However, I really need to be able to see all of my shapes, and would like response times to be reasonable.  The WFS url request loads in less than 10 seconds, so, I would not want much more overhead above that.

 

Any suggestions?

 

Thanks,

r.b. 

 

-----Original Message-----
From: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] On Behalf Of Burgholzer,Robert
Sent: Friday, September 28, 2007 3:06 PM
To: users at openlayers.org
Subject: Re: [OpenLayers-Users] trouble with WFS and Mapserver

 

Still trying, and have no joy from the WFS layer.

 

I set the isBaseLayer: true, and this succeeded in removing the issue surrounding the javascript maxExtent error.

 

I verified my projection info, wfs_srs and wms_srs are set to EPSG:4326, and my layer projection is now set to "init:EPSG:4326", however, I still get a blank map.  My firebug skills are virtually non-existent, and I have stumbled around, failing to locate the request for the WFS-layer as Arnd recommended. 

 

At this point, I am totally flailing (and failing).  Other details that might prove relevant, Mapserver 4.10 on windows, and as mentioned before, I get a properly formed XML document with all shape info and column values and attributes when doing an URL getFeature request.

 

Can anyone who has set up a mapserver WFS request in OL possibly post the relevant excerpts from their map file, and javascript calls?

 

I am somewhat at a loss as to other parameters, having tried the request with and without "featureClass: OpenLayers.Feature.WFS" in the additional parameters field.

 

Thanks!

r.b.

 

 

-----Original Message-----
From: arnd.wippermann at web.de [mailto:arnd.wippermann at web.de] 
Sent: Thursday, September 27, 2007 4:58 PM
To: Burgholzer,Robert
Cc: users at openlayers.org
Subject: AW: [OpenLayers-Users] trouble with WFS and Mapserver

 

when you use FF with firebug, you can get the request for the WFS-layer. Something like this:

 

http://geturl.asp?http%3A//localhost/mapserv.exe%3Fmap%3DTreppen.map <http://geturl.asp?http%3A/localhost/mapserv.exe%3Fmap%3DTreppen.map> 
%26typename%3DPOI
%26maxfeatures%3D10
%26SERVICE%3DWFS
%26VERSION%3D1.0.0
%26REQUEST%3DGetFeature
%26SRS%3DEPSG%253A4326
%26BBOX%3D6.416875%2C50.556875%2C7.823125%2C51.963125

 

Retrieve the Url with your Internet Explorer and you should get some xml. If not than i would think your proxy is not right or your mapfile. If you cut the SRS and BBOX from the Url and then get an answer, it looks like you have a problem with the projections in your mapfile.

 

To get my own WFS-layer working, i have learned

 

1. if the SRS in the request is the same as the WFS-layer, I only have to declare a projection in the layer block

 

2. if the SRS in the request is different from the WFS-layer, I have to declare the requested SRS as 'wfs_srs'  'EPSG:xxxx' in the WEB block and the projection in the LAYER block of the WFS-layer. Then my data will reproject and show in OpenLayers.

 

You have also declare 'wms_srs' in the WEB block for the requested SRS.

 

What I not understand, is, when I'm right with my mapfile, I must have for different requested SRS an own mapfile.

Mit freundlichen Grüssen

Arnd Wippermann
http://gis.ibbeck.de/ginfo/

 

  _____  

Von: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] Im Auftrag von Burgholzer,Robert
Gesendet: Donnerstag, 27. September 2007 22:06
An: users at openlayers.org
Betreff: [OpenLayers-Users] trouble with WFS and Mapserver

I am having a hard time getting my mapserver to serve up WFS layers (or accessing them via OpenLayers, I really don't know which).

 

I have tested the mapserver with WMS, and all is good. I am able to retrieve WFS data from mapserver via an URL request for getfeature, however, I get no success when trying to load it into openlayers via WFS, just a blank map.  In the javascript error console, all I get is an error that the "maxExtent has no properties", indicating that there are no valid layers, I assume, which is of course evidenced by the fact that my map is blank.

 

My creation statement and mapserver layer description is as follows:

 

OL:

            layer1 = new OpenLayers.Layer.WFS( "poli_bounds",

                    url, {'typename': 'poli_bounds'},

               {

                      typename: 'poli_bounds',

                      featureNS: 'http://www.openplans.org/topp',

                      extractAttributes: false

               } );

 

MAPFILE:

LAYER

   CONNECTIONTYPE postgis

   CONNECTION "host=localhost user=postgres password=*** dbname=wsp"

   NAME poli_bounds

   GROUP poli_bounds

   TYPE POLYGON

   STATUS DEFAULT

   DUMP TRUE

   DATA "the_geom from poli_bounds"

   FILTER "1 = 1"

   TEMPLATE drought.html

   #MINSCALE 1000

   #MAXSCALE 50000

   LABELITEM "name"

   CLASS

      NAME "Political Boundaries"

      SYMBOL 'circle'

      SIZE 3

      COLOR -1 -1 -1

      BACKGROUNDCOLOR 0 0 0

      OUTLINECOLOR 0 0 0

      LABEL

        COLOR 8 8 174

        #SHADOWCOLOR 218 218 218

        #SHADOWSIZE 2 2

        TYPE TRUETYPE

        FONT arial

        SIZE 7

        ANTIALIAS TRUE

        POSITION CC

        PARTIALS FALSE

        MINDISTANCE 300

        MINFEATURESIZE 30

        BUFFER 4

        #MINSCALE 1000

        #MAXSCALE 50000

      END # end of label

   END

   TOLERANCE 10

   PROJECTION

   # EPSG SRID = 4326

     "proj=latlong"

   END

   METADATA

    "DESCRIPTION"   "Political Boundaries"

    "RESULT_FIELDS" "name county state"

    "wfs_title"    "poli_bounds" ## REQUIRED

    "gml_featureid" "gid" ## REQUIRED

    "gml_include_items" "all"  ## Optional (serves all attributes for layer)

      "title" "Political Boundaries"

      "tablename" "Political Boundaries"

   END

END

 

 

Robert W. Burgholzer

Surface Water Modeler

Office of Water Supply and Planning

Virginia Department of Environmental Quality

rwburgholzer at deq.virginia.gov

804-698-4405

Open Source Modeling Tools:

http://sourceforge.net/projects/npsource/

Web-Based Water Supply Planning Demo:

http://soulswimmer.dynalias.net/models/wsdemo/demo_hsi.php

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20070928/955105f3/attachment.html


More information about the Users mailing list