> > I don't want to deny there is a problem when issuing ogrinfo, but I'm not > > sure that setting a default MAXFEATURES on client side is appropriate. > > The issue is more with GetExtent() and the fact that the reported extent > > in GetCapabilities is reported as WGS84 and not in the default SRS, or > > that the values are sometimes junk. > > Sure they are often junk but doing getFeature is an expensive way for > getting the correct information. Ald also this result may be unreliable if > it is interpreted to describe the whole WFS feature type it getFeature > request hits the server side maxFeatures limit. In this case ogrinfo can > only report the extents of the first [maxFeatures] of the feature type. > > How about having an option -TRUST_GETCAPABILITIES=TRUE and use it as > a default value? So number of feature could be examined with > resulttype=hits and extents could be taken as they are in the > getCapabilities. Or perhaps they could be reported as unknown if > reprojecting the lat/lon bounding box feels bad or is > inaccurate/impossible? Extents are not always so interesting. >
I also somehow imagined that. Perhaps you could file a ticket about that, so it can be eventually considered later. > > What do you get with these two requests (check layer info - download and > convert to shapefile) against this small WFS feature type? > > ogrinfo WFS:http://hip.latuviitta.org/cgi-bin/tinyows municipalities > ogr2ogr -f "ESRI Shapefile" test.shp WFS:http://hip.latuviitta.org/cgi-bin > /tinyows municipalities > > I can see that for me with a Windows laptop two sets of requests are sent. I just get one GetFeature for each command line as expected. Did you expect caching between ogrinfo and ogr2ogr ? The caching is just for one OGR session "of course". $ ogrinfo WFS:http://hip.latuviitta.org/cgi-bin/tinyows municipalities --debug on WFS: http://hip.latuviitta.org/cgi- bin/tinyows?SERVICE=WFS&REQUEST=GetCapabilities&ACCEPTVERSIONS=1.1.0,1.0.0 HTTP: Fetch(http://hip.latuviitta.org/cgi- bin/tinyows?SERVICE=WFS&REQUEST=GetCapabilities&ACCEPTVERSIONS=1.1.0,1.0.0) WFS: GetFeature operation supports hits WFS: Transaction support ! OGR: OGROpen(WFS:http://hip.latuviitta.org/cgi-bin/tinyows/0x94ac60) succeeded as WFS. INFO: Open of `WFS:http://hip.latuviitta.org/cgi-bin/tinyows' using driver `WFS' successful. OGR: GetLayerCount() = 55 HTTP: Fetch(http://hip.latuviitta.org/cgi- bin/tinyows?SERVICE=WFS&VERSION=1.1.0&REQUEST=DescribeFeatureType&TYPENAME=lv:municipalities,lv:mml_kunta10k_2011_l,lv:mml_kunta10k_2011_p,lv:mml_kunta100k_2011_l,lv:mml_kunta100k_2011_p,lv:mml_kunta250k_2011_l,lv:mml_kunta250k_2011_p,lv:mml_kunta1000k_2011_l,lv:mml_kunta1000k_2011_p,lv:mml_kunta4500k_2011_l,lv:mml_kunta4500k_2011_p,lv:mml_airport,lv:mml_asemat,lv:mml_avi1_l,lv:mml_avi1_p,lv:mml_cityp,lv:mml_coast_l,lv:mml_coast_p,lv:mml_dcont_l,lv:mml_dcont_p,lv:mml_forest,lv:mml_hcont_l,lv:mml_hcont_p,lv:mml_hpoint,lv:mml_kunta1_l,lv:mml_kunta1_p,lv:mml_kunta1_maa_alue,lv:mml_lake_l,lv:mml_lake_p,lv:mml_maaku1_l,lv:mml_maaku1_p,lv:mml_namep,lv:mml_pelto,lv:mml_railway,lv:mml_river,lv:mml_rivera_l,lv:mml_rivera_p,lv:mml_road,lv:mml_suot,lv:mml_taajama,lv:mml_paikannimet20,lv:peltolohkot_2011,lv:pks_pienalue,lv:pks_suuralue,lv:pks_tilastoalue,lv:pks_pienalue_piste,lv:pks_suuralue_piste,lv:pks_tilastoalue_piste,lv:natura2000_suomi_2010) Layer name: lv:municipalities Geometry: Multi Polygon WFS: http://hip.latuviitta.org/cgi- bin/tinyows?SERVICE=WFS&VERSION=1.1.0&REQUEST=GetFeature&TYPENAME=lv:municipalities&RESULTTYPE=hits HTTP: Fetch(http://hip.latuviitta.org/cgi- bin/tinyows?SERVICE=WFS&VERSION=1.1.0&REQUEST=GetFeature&TYPENAME=lv:municipalities&RESULTTYPE=hits) Feature Count: 343 WFS: http://hip.latuviitta.org/cgi- bin/tinyows?SERVICE=WFS&VERSION=1.1.0&REQUEST=GetFeature&TYPENAME=lv:municipalities HTTP: Fetch(http://hip.latuviitta.org/cgi- bin/tinyows?SERVICE=WFS&VERSION=1.1.0&REQUEST=GetFeature&TYPENAME=lv:municipalities) GML: Using Expat reader OGR: OGROpen(/vsimem/tempwfs_0x9cd770/file.gml/0xac0a00) succeeded as GML. GML: ResetReading() GML: ResetReading() GML: ResetReading() Extent: (61684.000000, 6605838.000000) - (732897.000000, 7776424.000000) Layer SRS WKT: PROJCS["ETRS89 / TM35FIN(E,N)", GEOGCS["ETRS89", DATUM["European_Terrestrial_Reference_System_1989", SPHEROID["GRS 1980",6378137,298.257222101, AUTHORITY["EPSG","7019"]], TOWGS84[0,0,0,0,0,0,0], AUTHORITY["EPSG","6258"]], PRIMEM["Greenwich",0, AUTHORITY["EPSG","8901"]], UNIT["degree",0.0174532925199433, AUTHORITY["EPSG","9122"]], AXIS["Latitude",NORTH], AXIS["Longitude",EAST], AUTHORITY["EPSG","4258"]], PROJECTION["Transverse_Mercator"], PARAMETER["latitude_of_origin",0], PARAMETER["central_meridian",27], PARAMETER["scale_factor",0.9996], PARAMETER["false_easting",500000], PARAMETER["false_northing",0], UNIT["metre",1, AUTHORITY["EPSG","9001"]], AXIS["Easting",EAST], AXIS["Northing",NORTH], AUTHORITY["EPSG","3067"]] Geometry Column = the_geom gml_id: String (0.0) suuralue: String (0.0) avi: String (0.0) maakunta: String (0.0) seutukunta: String (0.0) kunta: String (0.0) suural_ni1: String (0.0) suural_ni2: String (0.0) avi_ni1: String (0.0) avi_ni2: String (0.0) maaku_ni1: String (0.0) maaku_ni2: String (0.0) seutuk_ni1: String (0.0) seutuk_ni2: String (0.0) kunta_ni1: String (0.0) kunta_ni2: String (0.0) kieli_ni1: String (0.0) kieli_ni2: String (0.0) kaupunki: Integer (0.0) shape_leng: Real (0.0) shape_area: Real (0.0) OGRFeature(lv:municipalities):1 gml_id (String) = municipalities.1 suuralue (String) = 4 avi (String) = 6 maakunta (String) = 19 seutukunta (String) = 197 kunta (String) = 890 suural_ni1 (String) = Pohjois-Suomi suural_ni2 (String) = Norra Finland avi_ni1 (String) = Lapin aluehallintovirasto avi_ni2 (String) = Regionförvaltningsverket i Lappland maaku_ni1 (String) = Lappi maaku_ni2 (String) = Lappland seutuk_ni1 (String) = Pohjois-Lapin seutukunta seutuk_ni2 (String) = N_A kunta_ni1 (String) = Utsjoki kunta_ni2 (String) = N_A kieli_ni1 (String) = Suomi kieli_ni2 (String) = N_A kaupunki (Integer) = 1 shape_leng (Real) = 348861.033197 shape_area (Real) = 5378678737.73 [...] $ ogr2ogr -f "ESRI Shapefile" test.shp WFS:http://hip.latuviitta.org/cgi- bin/tinyows municipalities -overwrite --debug on WFS: http://hip.latuviitta.org/cgi- bin/tinyows?SERVICE=WFS&REQUEST=GetCapabilities&ACCEPTVERSIONS=1.1.0,1.0.0 HTTP: Fetch(http://hip.latuviitta.org/cgi- bin/tinyows?SERVICE=WFS&REQUEST=GetCapabilities&ACCEPTVERSIONS=1.1.0,1.0.0) WFS: GetFeature operation supports hits WFS: Transaction support ! OGR: OGROpen(WFS:http://hip.latuviitta.org/cgi-bin/tinyows/0x224fc60) succeeded as WFS. Shape: DBF Codepage = LDID/87 for test.shp Shape: Treating as encoding 'ISO-8859-1'. OGR: OGROpen(test.shp/0x2321b30) succeeded as ESRI Shapefile. HTTP: Fetch(http://hip.latuviitta.org/cgi- bin/tinyows?SERVICE=WFS&VERSION=1.1.0&REQUEST=DescribeFeatureType&TYPENAME=lv:municipalities,lv:mml_kunta10k_2011_l,lv:mml_kunta10k_2011_p,lv:mml_kunta100k_2011_l,lv:mml_kunta100k_2011_p,lv:mml_kunta250k_2011_l,lv:mml_kunta250k_2011_p,lv:mml_kunta1000k_2011_l,lv:mml_kunta1000k_2011_p,lv:mml_kunta4500k_2011_l,lv:mml_kunta4500k_2011_p,lv:mml_airport,lv:mml_asemat,lv:mml_avi1_l,lv:mml_avi1_p,lv:mml_cityp,lv:mml_coast_l,lv:mml_coast_p,lv:mml_dcont_l,lv:mml_dcont_p,lv:mml_forest,lv:mml_hcont_l,lv:mml_hcont_p,lv:mml_hpoint,lv:mml_kunta1_l,lv:mml_kunta1_p,lv:mml_kunta1_maa_alue,lv:mml_lake_l,lv:mml_lake_p,lv:mml_maaku1_l,lv:mml_maaku1_p,lv:mml_namep,lv:mml_pelto,lv:mml_railway,lv:mml_river,lv:mml_rivera_l,lv:mml_rivera_p,lv:mml_road,lv:mml_suot,lv:mml_taajama,lv:mml_paikannimet20,lv:peltolohkot_2011,lv:pks_pienalue,lv:pks_suuralue,lv:pks_tilastoalue,lv:pks_pienalue_piste,lv:pks_suuralue_piste,lv:pks_tilastoalue_piste,lv:natura2000_suomi_2010) Shape: DBF Codepage = LDID/87 for test Shape: Treating as encoding 'ISO-8859-1'. WFS: http://hip.latuviitta.org/cgi- bin/tinyows?SERVICE=WFS&VERSION=1.1.0&REQUEST=GetFeature&TYPENAME=lv:municipalities HTTP: Fetch(http://hip.latuviitta.org/cgi- bin/tinyows?SERVICE=WFS&VERSION=1.1.0&REQUEST=GetFeature&TYPENAME=lv:municipalities) GML: Using Expat reader OGR: OGROpen(/vsimem/tempwfs_0x22d28f0/file.gml/0x2460c00) succeeded as GML. GML: ResetReading() GML: ResetReading() Warning 1: Value '5378678737.729999542236328' of field shape_area has been truncated to 24 characters. This warning will not be emitted any more for that layer. OGR2OGR: 343 features written in layer 'test' > > I am ready to surrender, though, with one tiny remark: Is is necessary to > do at all the first getFeature with resulttype=hits if the next request is > always a full getFeature? GDAL can count the number of features returned > by thet second query and the resulttype=hits one can also be rather > expensive for the WFS server. I can understand that, but the key to understand the behaviour you observe is that the OGR WFS driver has no idea that it is called in the context of ogrinfo. So when ogrinfo issues a GetFeatureCount(), there's no reason to issue a full GetFeature. Plus the fact that GetFeatureCount() is faster than full GetFeature on big layers, so you might still be interested to know how many features there are by just downloading a few bytes *before* issuing the full GetFeature > > -Jukka Rahkonen-_______________________________________________ > gdal-dev mailing list > [email protected] > http://lists.osgeo.org/mailman/listinfo/gdal-dev _______________________________________________ gdal-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/gdal-dev
