Opened 19 years ago

Closed 19 years ago

Last modified 19 years ago

#1409 closed defect (fixed)

WFS not working as expected for Multi-point Postgis table

Reported by: h.viola@… Owned by: sdlime
Priority: high Milestone:
Component: WFS Server Version: 4.6
Severity: normal Keywords:
Cc:

Description

I've posted this on the MapServer users list (and had no reply) twice, so
thought I should just log it as a bug. 

It regards reading a PostGIS table of type MULTIPOINT into
MapServer and providing a WFS, containing the Multipoint data type within
GML <gml:MultiPoint>.

I have undertaken the following steps

1. Created a multipoint shapefile
2. Loaded the multipoint shapefile into PostGIS as a MULTIPOINT table
3. Read and displayed the shapefile into MapServer as a POINT layer
4. Read and displayed the PostGIS MULTIPOINT table into MapServer as a POINT
layer
5. Accessed the multipoint shapefile layer via WFS and successfully received
back <gml:MultiPoint> data with many <gml:Point> entries.
 BUT
6. When accessing the MULTIPOINT PostGIS layer via WFS, the GML returned was
unfortunately not MULTIPOINT GML. It returned only the first point in each
section of data as a single point entry <gml:Point>, so that most of the
data was missing from the WFS output (even though it all displayed ok when
visualised in MapServer).


This address gives an example of WFS, which should show several points per
multipoint entry, but only includes one entry for each <rain_level> value:
http://www4.bom.gov.au/cgi-bin/mapserver/mapserv?map=/web/htdocs/mapserver/radar_wfs.map&version=1.0.0&service=WFS&request=GetFeature&typename=radarseaus

Is this a bug that could be fixed?


Thank you for your time
Hester
h.viola@bom.gov.au

Change History (22)

comment:1 by sdlime, 19 years ago

Cc: steve.lime@… added

comment:2 by sdlime, 19 years ago

What does the mapfile snippet look like for that layer? There were siginificant 
changes in how GML is produced in 4.6. You may simply need to add another 
metadata element...

Steve

comment:3 by h.viola@…, 19 years ago

Hi Steve,

If you can advise on extra Metadata that may make a Multipoint Postgis layer
work for WFS, that would be terrific
This is the code I tried in MS and receive a single GML point for each
rain_level value, even though there should be many.
#######################
#Radar (latest)
LAYER
  CONNECTIONTYPE postgis
  NAME "radarseaus"
  GROUP "Weather Data"
  CONNECTION "host=www4.bom.gov.au user=bom password=bom    dbname=spatial_data"
  DATA "the_geom from tbl_idr_seaus"
  STATUS ON
  TYPE POINT
  TRANSPARENCY 50
  SYMBOLSCALE 3000000
  DUMP TRUE # For WFS server
  CLASSITEM "rain_level"
  CLASS
    EXPRESSION ([rain_level] = 1)
    COLOR 245 245 255
    symbol 3
    MAXSIZE 50
    MINSIZE 2

  END
  CLASS
    EXPRESSION ([rain_level] = 15)
    COLOR 40 0 0
    symbol 3
    MAXSIZE 50
    MINSIZE 2
  END
  METADATA
      WMS_TITLE "Radar for SE Australia"
      WMS_ABSTRACT "Radar (16-level) imagery for SE Australia"
      WMS_SRS "EPSG:4283"
      wms_group_title "Weather Data"
      WFS_TITLE "Radar for SE Australia"
      WFS_ABSTRACT "Radar (16-level) imagery for SE Australia"
      WFS_SRS "EPSG:4283"
  END
END

########################################3

Thanks



comment:4 by sdlime, 19 years ago

I wonder if PostGIS advertises multipoint features correctly back to MapServer. 
Do you have the ability to set this up using a multipoint shapefile?

I just got back from holiday and will do some investigation on this end shortly.

Steve

comment:5 by h.viola@…, 19 years ago

Hi Steve, 
Thanks for continuing with this. 

WFS of multipoint shapefile:-
http://www4.bom.gov.au/cgi-bin/mapserver/mapserv?map=/web/htdocs/mapserver/radar_wfs.map&version=1.0.0&service=WFS&request=GetFeature&typename=radarmultipoint
Raw data shapefile is at:-
http://www4.bom.gov.au/mapserver/spatial_data/shapefiles/weather_data/IDR_SEAUS.shp
WFS of equivalent data in postgis:-
http://www4.bom.gov.au/cgi-bin/mapserver/mapserv?map=/web/htdocs/mapserver/radar_wfs.map&version=1.0.0&service=WFS&request=GetFeature&typename=radarseaus

comment:6 by sdlime, 19 years ago

Status: newassigned
Ok, I did find a problem with multipoint output. The goemetry container was not 
being closed properly. I did not have any problem with the multiple points not 
showing up, not with the shapefile anyway. Here's the mapfile I used:

MAP
  NAME TEST
  UNITS DD
  EXTENT 137.692688 -43.087616 148.003159 -35.100861

  WEB
    METADATA
      wfs_title                         "Bug 1409"
      wfs_abstract                      "Test server for bug 1409."
      wfs_srs                           "EPSG:4269"
      wfs_onlineResource                "http://noah.dnr.state.mn.us/cgi-
bin/mapserv48?map=/home/stlime/tmp/wfs/test.map"      
      wfs_namespace_prefix              "test"
      wfs_namespace_uri                 "http://noah.dnr.state.mn.us/test"
    END
  END

  LAYER
    NAME "multipoint1"
    TYPE POINT

    DATA "IDR_SEAUS"
    DUMP TRUE

    # projection
    PROJECTION
      "+init=epsg:4269"
    END

    # metadata
    METADATA
      wfs_title "Sea Surface Temperature"
      wfs_abstract "A sample mulipoint dataset."
      wfs_keywordlist "tempature, ocean"
      gml_include_items "all"
      gml_geometries "stations"
      gml_stations_type "multipoint"        
      #gml_stations_type "point"
      #gml_stations_occurances "0,UNBOUNDED"
    END
  END
END 

Note the extra bit of metadata. That allows you to define an element to hold 
the geometry (e.g. stations) and to define the type of that element (e.g. 
multipoint). You can define mixed geometry types this way, for example some 
polygons and some multipolygons. However most of the time you'll just define 
one. You can also control how multithings are handled. For example, if you were 
to use the commented out metadata above you'd get a bunch of stations each with 
only 1 point.

You don't need this metadata though. MapServer will create a default container 
(msGeometry) and use whatever GML construct that makes sense. Works for GML2 or 
GML3 output

You can see the output from my server at:

  http://noah.dnr.state.mn.us/cgi-bin/mapserv48?
map=/home/stlime/tmp/wfs/test.map&service=WFS&version=1.0.0&request=getFeature&t
ypename=multipoint1&outputformat=GML3

I have updated both CVS HEAD (4.7/4.8) and the 4.6 branch with my fix.

Steve

comment:7 by dmorissette, 19 years ago

Cc: mapserver-bugs@… added
Owner: changed from mapserverbugs to sdlime
Status: assignednew
Reassigned bug to Steve. Can the bug be marked as fixed now?

comment:8 by sdlime, 19 years ago

Status: newassigned
I'd like confirmation from the user first, but otherwise this one's done.

Steve

comment:9 by h.viola@…, 19 years ago

Hi,

AFter further testing and playing around, this issue does not appear to be
resolved I'm afraid. 
I put in the extra metadata as suggested and have installed MS4.7, but the
problem remains. 

The shapefile is represented correctly in GML with appropriate <gml:Point>
entries for each <gml:MultiPoint srsName="EPSG:4283"> within the feature members
- see:
http://www4.bom.gov.au/cgi-bin/mapserver/mapserv4.7?map=/web/htdocs/mapserver/radar_wfs.map&version=1.0.0&service=WFS&request=GetFeature&typename=radarmultipoint

But from the PostGIS table, the multipoint information is still lost - see:
http://www4.bom.gov.au/cgi-bin/mapserver/mapserv4.7?map=/web/htdocs/mapserver/radar_wfs.map&version=1.0.0&service=WFS&request=GetFeature&typename=radarnsw
with only a single <gml:Point srsName="EPSG:4283"> showing in the GML for each
collection of attributes.

I would really appreciate any more help you can offer. We're keen to persist
with PostGIS. 

Thanks
Hester

comment:10 by sdlime, 19 years ago

And if you use the multipoint shapefile?

Steve

comment:11 by h.viola@…, 19 years ago

Hi again Steve,

Yes it works as expected with a shapefile,
http://www4.bom.gov.au/cgi-bin/mapserver/mapserv?map=/web/htdocs/mapserver/radar_wfs.map&version=1.0.0&service=WFS&request=GetFeature&resultformat=GML3&typename=radarmultipoint
 
but we are using PostGIS for our data and would like to make it work as expected
from the database. 

If there is anything you can do, it would be greatly appreciated. 

Thanks

comment:12 by sdlime, 19 years ago

Cc: pramsey@… added
Need to get Paul Ramsey in on this one then since it's not really a WFS issue
(may be a query problem). Can you draw the multipoints from PostGIS or do you
just see the single point. Try drawing using shp2img...

Steve

comment:13 by h.viola@…, 19 years ago

Hi,

We have not had any problems symbolising the Multipoint data from PostGIS. It
works in the CGI with html template and via WMS

eg 
http://www4.bom.gov.au/cgi-bin/mapserver/mapserv?map=/web/htdocs/mapserver/weather.map&version=1.1.3&service=WMS&request=GetMap&layers=radarseaus,radarwa,radarnsw,radarnt&bbox=140,-40,160,-20

 

comment:14 by sdlime, 19 years ago

Is there any chance I could access your PostGIS server from here for testing?

Steve

comment:15 by h.viola@…, 19 years ago

Hi Steve,

I'm not really clear whether you need to access the PostGIS data via a .map file
or if you're asking to actually log on to the server www4.bom.gov.au to use psql
and view the multipoint tables that way?
If you just require access to the multipoint  tables via a .map file then the
details below will help. 
Otherwise perhaps we can discuss it directly via email and I will see if we can
provide a read-only login for you to use temporarily. 

The details are as follows:
LAYER
  CONNECTIONTYPE postgis
  NAME "radarnsw"
  GROUP "Weather Data"
  CONNECTION "host=www4.bom.gov.au user=bom password=bom dbname=spatial_data"
  DATA "the_geom from tbl_idr_nsw"
  STATUS ON
  TRANSPARENCY 50
  TYPE POINT
  SYMBOLSCALE 3000000
  DUMP TRUE # For WFS server
  CLASSITEM "rain_level"
  etc ...
an example of the symbols used is in the following text file. 
http://www4.bom.gov.au/mapserver/archive/radar_nsw.txt
Be aware though, there is not much rain around at the moment so this table might
be very small. Other tables you could try are as follows tbl_idr_sa,
tbl_idr_qld, tbl_idr_nt, tbl_idr_wa or tbl_idr_seaus.

Thanks for your time on this.




comment:16 by sdlime, 19 years ago

Disregard that request. I set up a PostGIS server today and can test with that.
We're an SDE shop *sigh* so I didn't have anything to test with until today.
I'll see if I can find some time yet this week to fix this.

Steve 

comment:17 by sdlime, 19 years ago

I am working on this. Getting friggin' xerces working on a mac, so ogr compiles,
so wfs support works is a pain. Hopfully this weekend.

Steve

comment:18 by sdlime, 19 years ago

Ok, I've replicated the error here. Appears to be PostGIS specific. More soon...

Steve

comment:19 by sdlime, 19 years ago

Flexibility has it's problems I guess. There are apprarently 2 ways that
multipoint features are stored. In one you define a single linestring with
multiple points and in the other, multiple linestrings each with a single point.
The PostGIS driver does the latter, the shapefile driver the former. The drawing
routines allow for both. The GML writer(s) do not, so I've updated them to do
so.  The change has only been made to the development version. I'll back port
once the fix is confirmed to work in 4.7. 

This is not a problem with the PostGIS driver...

Steve

comment:20 by h.viola@…, 19 years ago

Cc: pramsey@… removed
Thanks Steve,
We are just about to grab the CVS update and will let you know whether that is
successful.
Cheerio
Hester 

comment:21 by sdlime, 19 years ago

Resolution: fixed
Status: assignedclosed
Well, no news is good news I guess. Closing...

Steve

comment:22 by h.viola@…, 19 years ago

Thanks Steve, all is good
Note: See TracTickets for help on using tickets.