[GIS] Geoserver WFS GetFeature returns no features when reprojecting PostGIS layer

coordinate systemgeoservergetfeaturepostgiswfs

I may be misunderstanding the GeoServer documents, but when accessing a GeoServer 2.2 WFS 1.1 layer, should I be able to reproject to an arbitrary SRS via the SRSNAME parameter? I'm generating a bounding box from the location of a click on a WMS map where I know there is a feature. The map is projected into UTM zone 15 (EPSG:32615). So I generate the following URL:

http://server.domain.com/geoserver/MyWorkspace/wms?SERVICE=WFS&VERSION=1.1.0&REQUEST=GetFeature&TYPENAME=MyWorkspace%3AMyLayer&MAXFEATURES=9&SRSNAME=EPSG%3a32615&BBOX=382138.16774714%2c4587006.11489167%2c382138.16774714%2c4587006.11489167&

This query returns 0 features, and I don't know why. It's essentially the same query I was using for another layer, also served from GeoServer, that was sourced from a shapefile in EPSG:32615, where the query worked. So here's what's different about this layer:

  1. I'm using PostGIS for a backend on the new layer; the old one was a shapefile
  2. The shapefile was in EPSG:32615; the PostGIS table is in EPSG:4326
  3. The PostGIS table is using the "geography" data type rather than the "geometry" data type, if that's relevant.

Any ideas?

Best Answer

For others who come across this question, here's what I've learned so far:

PostGIS and the geography data type appear to be red herrings.

In WFS 1.0, you can't project on the fly and the BBOX is expected to be specified in the same projection as the features.

In WFS 1.1, reprojection is supported, but by default the BBOX is interpreted as CRS84. Unlike in WMS, there is no BBOXSR parameter, but you can append a "crsuri" string to the end of your BBOX parameter specifying the CRS of the BBOX. Unfortunately, you can't just say "EPSG:32615" but have to use a CRS URI like "urn:ogc:def:crs:OGC:1.3:CRS84". The crsuri must be a valid URI, and it appears codes like "EPSG:32615" are accepted, at least by GeoServer, though the blog I found recommends the urn format shown above. I haven't yet found the spec for these URI's, so I don't know whether they're application-specific or there's some universal way to say "WGS84, UTM 15". I'd love for someone more knowledgeable to weigh in on this.

Anyway, here is the blog post where I got most of my information.

Anyone know where to find a true API reference for WFS? All I can find are the implementation spec and the documentation for various WFS server applications.