I started capturing the http traffic with wireshark so that I could see
the exact network query as it goes across the wire.
I want to query for
Envelope bbox = new Envelope( -121.618652,-121.313782,38.231708,38.440682 );
The request that actually goes across the wire looks like:
serverurl.wfs?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&BBOX=-121.313782,-66.00001246666649,18.000004648959784,38.231708&TYPENAME=MapunitPoly
Notice the -66 and the 18 in the network query - I didn't set those.
Geotools must intersect the requested bounds with the reported bounds
from the GetCapabilities values.
When I hit the getCapabilities link the layer I'm interested in reports
its LatLongBoundingBox as:
<LatLongBoundingBox minx="-178.5" miny="18" maxx="-66" maxy="72"/>
But when I print out these bounds in Geotools...
System.out.println( " FeatureSource Bounds:"+data.getFeatureSource(
typeName ).getBounds());
I see:
FeatureSource Bounds:ReferencedEnvelope[18.000004666553526 :
71.99999845030135, -178.49999080798324 : -66.00001246666649]
It seems the X and the Y values are switched.
If I hand change the generated request to:
serverurl.wfs?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&
BBOX=-121.323782,38.231708,-121.313782,38.440682&TYPENAME=MapunitPoly
the server gives me a bunch of valid looking polygons.
Is there something I'm doing wrong?
On 3/5/2010 3:02 PM, Jody Garnett wrote:
SERVICE=WMS&REQUEST=GetCapabilities
WFS supports several kinds of requests:
- GetCapabilities describes what sevices and data the WFS procides
- DescribeFeatureType produces an XML Schema defining the attributes being
published
- GetFeatures is used when requesting XML content (that is valid against the
schema from DescribeFeatureType)
Usually the DescribeFeatureType makes use of the Geographic Markup Language ideas for
Geometry etc...; in that respect the XML content reuturned by GetFeatures is considered
to be "GML".
Jody
On 05/03/2010, at 1:24 PM, Ryan Ripken wrote:
I'm trying to use Geotools 2.5.5 and the WFSExample.java example file to
connect to a public WFS server and download a polygon shape file.
When I get to "Step 5" I get a ServiceException about the "Request"
parameter missing.
Is there something I need to do to add a Request parameter to my query?
I've gone through the first couple pages of Google results and I found
some reports that MapServer required "Service=wfs" added to the url.
http://trac.osgeo.org/mapserver/ticket/1262
http://lists.osgeo.org/pipermail/mapserver-users/2007-November/026301.html
Is that my problem?
This page includes an example wfs link on the server I'd like to use,
http://sdmdataaccess.nrcs.usda.gov/WebServiceHelp.aspx . The example
link seems to work and includes SERVICE=WFS in the getFeature request.
So, assuming this is the problem, Is there something easy I might do in
the Geotools client code to work around it?
Perhaps an api I could use to modify the url being generated before the
request is executed? Or a way to add additional parameters to the
request? Or perhaps a class I could extend and a method to override
where I could recognize the hostname and add the parameter?
I stepped into the WFS feature code with the debugger but it isn't
immediately obvious to me where things are going wrong or where I might
be able to modify the requests. Appreciate any feedback - even if it is
just "yeah, thats your problem"
Thanks,
Ryan
Here is the output of my program.
**** Step 1: Connection Parameters
**** Step 2: Connection
**** Step 3: Discovery
title:NRCS Soil Data Mart Data Access Web Feature Service WGS84
typeNames[0]=MapunitPoly
typeNames[1]=MapunitPolyNoGeometry
typeNames[2]=MapunitLine
typeNames[3]=MapunitPoint
typeNames[4]=MapunitPolyExtended
typeNames[5]=SurveyAreaPoly
using:MapunitPoly
Schema Attributes:8
attributeDescriptor[0]=multiPolygon
attributeDescriptor[1]=AREASYMBOL
attributeDescriptor[2]=SPATIALVERSION
attributeDescriptor[3]=MUSYM
attributeDescriptor[4]=MUKEY
attributeDescriptor[5]=SHAPE
attributeDescriptor[6]=OBJECTID
attributeDescriptor[7]=OBJECTID
**** Step 4: target:MapunitPoly
FeatureSource Bounds:ReferencedEnvelope[18.0 : 72.0, -178.5 : -66.0]
**** Step 5: Query
GeometryDescriptor LocalName: multiPolygon
Built filter:[ multiPolygon intersects POLYGON ((-121.618652
38.231708, -121.313782 38.231708, -121.313782 38.440682, -121.618652
38.440682, -121.618652 38.231708)) ]
Mar 4, 2010 5:32:07 PM org.geotools.xml.XMLSAXHandler processException
SEVERE: Incomplete WFS request: 'Request' parameter missing.
org.geotools.xml.filter.FilterComplexTypes$ServiceExceptionType.getValue(FilterComplexTypes.java:1669)
org.geotools.xml.handlers.ComplexElementHandler.endElement(ComplexElementHandler.java:157)
org.geotools.xml.XMLSAXHandler.endElement(XMLSAXHandler.java:266)
org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown
Source)
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
Source)
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown
Source)
javax.xml.parsers.SAXParser.parse(Unknown Source)
javax.xml.parsers.SAXParser.parse(Unknown Source)
org.geotools.xml.DocumentFactory.getInstance(DocumentFactory.java:140)
org.geotools.data.wfs.v1_0_0.WFSFeatureReader.run(WFSFeatureReader.java:125)
Mar 4, 2010 5:32:07 PM org.geotools.xml.XMLSAXHandler endElement
WARNING: Incomplete WFS request: 'Request' parameter missing.
Mar 4, 2010 5:32:07 PM org.geotools.xml.XMLSAXHandler endElement
WARNING: Line 4 Col 72
Mar 4, 2010 5:32:07 PM org.geotools.data.wfs.v1_0_0.NonStrictWFSStrategy
createFeatureReaderPOST
WARNING: java.io.IOException: org.geotools.ows.ServiceException:
Incomplete WFS request: 'Request' parameter missing.
Mar 4, 2010 5:32:07 PM org.geotools.xml.XMLSAXHandler processException
SEVERE: Invalid request. Unable to determine spatial filter. (Unknown,
Unknown, Unknown).
org.geotools.xml.filter.FilterComplexTypes$ServiceExceptionType.getValue(FilterComplexTypes.java:1669)
org.geotools.xml.handlers.ComplexElementHandler.endElement(ComplexElementHandler.java:157)
org.geotools.xml.XMLSAXHandler.endElement(XMLSAXHandler.java:266)
org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown
Source)
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
Source)
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown
Source)
javax.xml.parsers.SAXParser.parse(Unknown Source)
javax.xml.parsers.SAXParser.parse(Unknown Source)
org.geotools.xml.DocumentFactory.getInstance(DocumentFactory.java:140)
org.geotools.data.wfs.v1_0_0.WFSFeatureReader.run(WFSFeatureReader.java:125)
Mar 4, 2010 5:32:07 PM org.geotools.xml.XMLSAXHandler endElement
WARNING: Invalid request. Unable to determine spatial filter. (Unknown,
Unknown, Unknown).
Mar 4, 2010 5:32:07 PM org.geotools.xml.XMLSAXHandler endElement
WARNING: Line 4 Col 103
Mar 4, 2010 5:32:07 PM org.geotools.data.wfs.v1_0_0.NonStrictWFSStrategy
createFeatureReaderGET
WARNING: java.io.IOException: org.geotools.ows.ServiceException: Invalid
request. Unable to determine spatial filter. (Unknown, Unknown, Unknown).
java.util.NoSuchElementException: Could not aquire
feature:java.io.IOException: org.geotools.ows.ServiceException: Invalid
request. Unable to determine spatial filter. (Unknown, Unknown, Unknown).
at
org.geotools.data.store.NoContentIterator.next(NoContentIterator.java:56)
at
org.geotools.data.store.NoContentIterator.next(NoContentIterator.java:41)
at hec.dgt.plugins.WFSExample.dataAccess(WFSExample.java:125)
at hec.dgt.plugins.WFSExample.main(WFSExample.java:52)
Caused by: java.io.IOException: org.geotools.ows.ServiceException:
Invalid request. Unable to determine spatial filter. (Unknown, Unknown,
Unknown).
at org.geotools.xml.gml.FCBuffer.hasNext(FCBuffer.java:326)
at
org.geotools.data.wfs.v1_0_0.WFSFeatureReader.loadElement(WFSFeatureReader.java:189)
at
org.geotools.data.wfs.v1_0_0.WFSFeatureReader.hasNext(WFSFeatureReader.java:178)
at
org.geotools.data.ReTypeFeatureReader.hasNext(ReTypeFeatureReader.java:190)
at
org.geotools.data.wfs.v1_0_0.NonStrictWFSStrategy.createFeatureReaderGET(NonStrictWFSStrategy.java:134)
at
org.geotools.data.wfs.v1_0_0.NonStrictWFSStrategy.createFeatureReader(NonStrictWFSStrategy.java:101)
at
org.geotools.data.wfs.v1_0_0.StrictWFSStrategy.access$101(StrictWFSStrategy.java:60)
at
org.geotools.data.wfs.v1_0_0.StrictWFSStrategy$StrictFeatureReader.nextReader(StrictWFSStrategy.java:222)
at
org.geotools.data.wfs.v1_0_0.StrictWFSStrategy$StrictFeatureReader.init(StrictWFSStrategy.java:171)
at
org.geotools.data.wfs.v1_0_0.StrictWFSStrategy$StrictFeatureReader.<init>(StrictWFSStrategy.java:145)
at
org.geotools.data.wfs.v1_0_0.StrictWFSStrategy.createFeatureReader(StrictWFSStrategy.java:84)
at
org.geotools.data.wfs.v1_0_0.NonStrictWFSStrategy.getFeatureReader(NonStrictWFSStrategy.java:72)
at
org.geotools.data.wfs.v1_0_0.WFS_1_0_0_DataStore.getFeatureReader(WFS_1_0_0_DataStore.java:740)
at
org.geotools.data.DefaultFeatureResults.reader(DefaultFeatureResults.java:210)
at
org.geotools.data.store.DataFeatureCollection.openIterator(DataFeatureCollection.java:229)
at
org.geotools.data.store.DataFeatureCollection.iterator(DataFeatureCollection.java:199)
at hec.dgt.plugins.WFSExample.dataAccess(WFSExample.java:122)
... 1 more
Caused by: org.geotools.ows.ServiceException: Invalid request. Unable
to determine spatial filter. (Unknown, Unknown, Unknown).
at org.geotools.xml.XMLSAXHandler.endElement(XMLSAXHandler.java:274)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown
Source)
at
org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown
Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown
Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at
org.geotools.xml.DocumentFactory.getInstance(DocumentFactory.java:140)
at
org.geotools.data.wfs.v1_0_0.WFSFeatureReader.run(WFSFeatureReader.java:125)
Caused by: org.geotools.ows.ServiceException: Invalid request. Unable
to determine spatial filter. (Unknown, Unknown, Unknown).
at
org.geotools.xml.filter.FilterComplexTypes$ServiceExceptionType.getValue(FilterComplexTypes.java:1669)
at
org.geotools.xml.handlers.ComplexElementHandler.endElement(ComplexElementHandler.java:157)
at org.geotools.xml.XMLSAXHandler.endElement(XMLSAXHandler.java:266)
... 13 more
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 9.0.787 / Virus Database: 271.1.1/2729 - Release Date: 03/07/10
11:34:00
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users