[gdal-dev] WFS driver does not do URL-encoding right

Even Rouault even.rouault at mines-paris.org
Wed Aug 15 12:45:08 PDT 2012


Le mercredi 15 août 2012 21:28:22, Jukka Rahkonen a écrit :
> GvSIG is also sending GetFeatures with http GET and filters and it had same
> kind of problems with special characters. Now the developers say that they
> have fixed URL encoding. I hope that the solution is somehow re-usable

I'm not sure this is a problem with URL encoding, but more a problem with the 
fact that the Windows console is not using UTF-8. So even if the OGR WFS 
driver did escape the special character, this wouldn't solve anything, since 
it would get a non UTF8 character and would escape it wrongly...

Some seraching would suggest that typing "chcp 65001" before might help, but 
I'm not sure...

I'm wondering if the GDAL command line utilities shouldn't use special 
instructions under Windows to better deal with Unicode characters. Some search 
would suggest that using wmain() and/or SetConsoleOutputCP() might help. Are 
there Windows programmers around that might give advice on how to get 
arguments in UTF-8 from the Windows command line ?

Anyway, with Linux, it works fine :

$ ogrinfo "WFS:http://188.64.1.61/cgi-bin/tinyows" -sql "select * from 
municipalities where kunta_ni1='Saarijärvi'" ro --debug on
WFS: http://188.64.1.61/cgi-
bin/tinyows?SERVICE=WFS&REQUEST=GetCapabilities&ACCEPTVERSIONS=1.1.0,1.0.0
HTTP: Fetch(http://188.64.1.61/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://188.64.1.61/cgi-bin/tinyows/0x1eaf190) succeeded as 
WFS.
INFO: Open of `WFS:http://188.64.1.61/cgi-bin/tinyows'
      using driver `WFS' successful.
layer names ignored in combination with -sql.
HTTP: Fetch(http://188.64.1.61/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_asuinalueet,lv:pks_teollisuusalueet,lv:pks_viheralueet,lv:pks_maankaytto,lv:pks_jarvet)

Layer name: municipalities
Geometry: Multi Polygon
WFS: http://188.64.1.61/cgi-
bin/tinyows?SERVICE=WFS&VERSION=1.1.0&REQUEST=GetFeature&TYPENAME=lv:municipalities&FILTER=<Filter 
xmlns="http://www.opengis.net/ogc" xmlns:lv="http://latuviitta.fi/" 
xmlns:gml="http://www.opengis.net/gml"><PropertyIsEqualTo><PropertyName>kunta_ni1</PropertyName><Literal>Saarijärvi</Literal></PropertyIsEqualTo></Filter>&RESULTTYPE=hits
HTTP: Fetch(http://188.64.1.61/cgi-
bin/tinyows?SERVICE=WFS&VERSION=1.1.0&REQUEST=GetFeature&TYPENAME=lv:municipalities&FILTER=%3CFilter%20xmlns=%22http://www.opengis.net/ogc%22%20xmlns:lv=%22http://latuviitta.fi/%22%20xmlns:gml=%22http://www.opengis.net/gml%22%3E%3CPropertyIsEqualTo%3E%3CPropertyName%3Ekunta_ni1%3C/PropertyName%3E%3CLiteral%3ESaarijärvi%3C/Literal%3E%3C/PropertyIsEqualTo%3E%3C/Filter%3E&RESULTTYPE=hits)
Feature Count: 1
WFS: http://188.64.1.61/cgi-
bin/tinyows?SERVICE=WFS&VERSION=1.1.0&REQUEST=GetFeature&TYPENAME=lv:municipalities&FILTER=<Filter 
xmlns="http://www.opengis.net/ogc" xmlns:lv="http://latuviitta.fi/" 
xmlns:gml="http://www.opengis.net/gml"><PropertyIsEqualTo><PropertyName>kunta_ni1</PropertyName><Literal>Saarijärvi</Literal></PropertyIsEqualTo></Filter>
VSICURL: Start download for http://188.64.1.61/cgi-
bin/tinyows?SERVICE=WFS&VERSION=1.1.0&REQUEST=GetFeature&TYPENAME=lv:municipalities&FILTER=%3CFilter%20xmlns=%22http://www.opengis.net/ogc%22%20xmlns:lv=%22http://latuviitta.fi/%22%20xmlns:gml=%22http://www.opengis.net/gml%22%3E%3CPropertyIsEqualTo%3E%3CPropertyName%3Ekunta_ni1%3C/PropertyName%3E%3CLiteral%3ESaarijärvi%3C/Literal%3E%3C/PropertyIsEqualTo%3E%3C/Filter%3E
GML: Using Expat reader
GML: Global SRS = EPSG:3067
GML: Using /vsimem/tempwfs_0x1f38d60/file.xsd
GML: ResetReading()
GML: ResetReading()
GML: ResetReading()
Extent: (372349.750000, 6933225.500000) - (433496.625000, 6976330.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"]]
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(municipalities):257
  gml_id (String) = municipalities.257
  suuralue (String) = 2
  avi (String) = 4
  maakunta (String) = 13
  seutukunta (String) = 138
  kunta (String) = 729
  suural_ni1 (String) = Länsi-Suomi
  suural_ni2 (String) = Västra Finland
  avi_ni1 (String) = Länsi- ja Sisä-Suomen aluehallintovirasto
  avi_ni2 (String) = Regionförvaltningsverket i Västra och Inre Finland
  maaku_ni1 (String) = Keski-Suomi
  maaku_ni2 (String) = Mellersta Finland
  seutuk_ni1 (String) = Saarijärven-Viitasaaren seutukunta
  seutuk_ni2 (String) = N_A
  kunta_ni1 (String) = Saarijärvi
  kunta_ni2 (String) = N_A
  kieli_ni1 (String) = Suomi
  kieli_ni2 (String) = N_A
  kaupunki (Integer) = 2
  shape_leng (Real) = 217890.793269
  shape_area (Real) = 1421634392.31
  MULTIPOLYGON (((431175.55 6965415.6,433032.45 6963484.87,433496.63 
6961995.55,432351.54 6959161.48,423520.98 6956704.84,423422.06 
6956644.06,422918.06 6955962.73,423083.85 6953557.94,423181.66 
6951635.51,423025.36 6951041.19,422504.5 6949076.54,421988.79 
6947131.72,421846.05 6946593.06,421657.17 6946136.92,421882.76 
6945904.69,422882.4 6944892.62,423357.37 6944492.15,424116.56 
6942683.6,424083.41 6942465.44,422808.01 6941696.47,421855.79 
6941095.75,422017.19 6936052.02,419804.12 6935199.87,420152.42 
6933980.52,418004.53 6933225.62,415856.59 6934154.51,415563.71 
6934940.76,413443.2 6935260.62,410080.95 6935303.47,406732.4 
6940340.15,405283.66 6940446.34,400536.73 6940067.59,395580.16 
6939666.46,394920.71 6939627.43,393296.99 6941629.18,392178.08 
6943009.1,388880.05 6940383.58,386820.25 6937431.16,385498.39 
6936754.31,382380.61 6935463.93,376786.52 6949235.01,376220.86 
6950627.73,376127.46 6950563.76,373019.66 6953049.78,372702.42 
6954380.45,372603.1 6954765.57,372349.76 6955805.15,374454.19 
6956467.94,375402.84 6957483.21,376693.11 6960172.06,379308.83 
6958442.84,380233.69 6959786.94,383043.44 6959588.0,385260.54 
6963460.37,386126.71 6962687.56,386482.41 6962309.48,387933.7 
6963064.38,389326.9 6964863.98,390205.83 6963726.52,390485.8 
6962642.8,390546.02 6960626.33,391081.01 6959431.29,391143.47 
6959390.35,391247.55 6959388.43,391380.73 6959410.82,391483.09 
6959414.66,391583.13 6959410.82,393919.24 6958183.8,394190.41 
6958043.06,395000.48 6959552.22,394025.91 6959996.84,394595.75 
6960744.06,395576.83 6962623.63,395307.5 6963381.72,394986.46 
6964198.03,394633.88 6964200.59,393400.07 6962755.4,393178.08 
6962814.9,392425.42 6963368.27,391563.51 6965746.83,396502.43 
6969234.09,399764.51 6971565.33,400074.27 6971787.96,402446.56 
6970262.82,403456.64 6967897.06,403516.58 6967892.58,403593.19 
6967903.45,403666.52 6967884.26,403770.08 6967819.65,403906.26 
6967769.75,404062.24 6967713.45,404584.71 6967312.34,405728.86 
6966534.41,406338.33 6965860.77,406816.11 6964471.25,413353.47 
6965814.09,413366.98 6966519.73,415997.31 6969484.31,419935.19 
6973875.52,421809.07 6975976.44,422135.82 6976320.62,423614.26 
6976330.22,426661.92 6976295.05,427289.53 6970722.89,429386.49 
6969247.65,431175.55 6965415.6)))

GenSQL: 1 features read on layer 'municipalities'.
GML: ResetReading()
VSICURL: Stop download for http://188.64.1.61/cgi-
bin/tinyows?SERVICE=WFS&VERSION=1.1.0&REQUEST=GetFeature&TYPENAME=lv:municipalities&FILTER=%3CFilter%20xmlns=%22http://www.opengis.net/ogc%22%20xmlns:lv=%22http://latuviitta.fi/%22%20xmlns:gml=%22http://www.opengis.net/gml%22%3E%3CPropertyIsEqualTo%3E%3CPropertyName%3Ekunta_ni1%3C/PropertyName%3E%3CLiteral%3ESaarijärvi%3C/Literal%3E%3C/PropertyIsEqualTo%3E%3C/Filter%3E


More information about the gdal-dev mailing list