Re: [geoserver-ita] Problemi con la trasformazioni WFS con estensione OGR

65 views
Skip to first unread message

Tobia Di Pisa

unread,
May 15, 2013, 8:12:16 AM5/15/13
to geoser...@googlegroups.com
Ciao,

vedendo questo nel log:

 Srs_def can be a full WKT definition (hard to escape properly),
 or a well known definition (ie. EPSG:4326) or a file with a WKT

mi viene da pensare che possa dipendere dal sistema di riferimento usato.
In alternativa credo che possa dipendere dalla versione di GDAL che stai utilizzando (forse le due cose sono collegate).
Usando la 1.7 anche io ho avuto dei problemi principalmente legati al geometry type. Passando a gdal 1.9 probabilmente potresti risolvere.

Saluti,
    Tobia Di Pisa



==
GeoServer training in Milan, 6th & 7th June 2013! Visit
http://geoserver.geo-solutions.it for more information.
==

Dott. Ing. Tobia Di Pisa
Software Engineer

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054  Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------


2013/5/14 Milan Antonovic <milan.a...@gmail.com>
Ciao a tutti,
Stavo preparando una nuova installazione server per un progetto legato al turismo. 
Agli utenti dopo aver selezionato un percorso, gli viene data la possibilità di esportare la geometria in due formati a scelta (KML e GPX).

Ma ho riscontrato alcuni problemi a far funzionare il plug-in "ogr2ogr output format".

Lanciando il comando ogr2ogr da terminale il risultato è quello desiderato.

ogr2ogr -f GPX -a_srs EPSG:4326 -nlt LINESTRING -dsco GPX_USE_EXTENSIONS=YES out.gpx in.gml

Mentre la richiesta WFS non funziona:



Std err

org.geoserver.platform.ServiceException: Exception occurred during output generation
at org.geoserver.wfs.response.Ogr2OgrOutputFormat.write(Ogr2OgrOutputFormat.java:274)
at org.geoserver.wfs.WFSGetFeatureOutputFormat.write(WFSGetFeatureOutputFormat.java:190)
        (...)

Risposta:

<?xml version="1.0" encoding="UTF-8"?>
<ows:ExceptionReport version="1.0.0"
  <ows:Exception exceptionCode="NoApplicableCode">
    <ows:ExceptionText>Exception occurred during output generation
ogr2ogr did not terminate successfully, exit code 1. Was trying to run: [ogr2ogr, -f, GPX, -a_srs, /usr/local/tomcat/temp/ogrtmpin0.010488442767998762/gdal_srs4540716017553286832wkt, -dsco GPX_USE_EXTENSIONS=YES, -skipfailures, -nlt LINESTRING, /usr/local/tomcat/temp/ogrtmpout0.9765302869865903/map_tra_eng.gpx, /usr/local/tomcat/temp/ogrtmpin0.010488442767998762/map_tra_eng.gml]
Resulted in:

Usage: ogr2ogr [--help-general] [-skipfailures] [-append] [-update] [-gt n]
               [-select field_list] [-where restricted_where] 
               [-progress] [-sql &lt;sql statement&gt;] [-dialect dialect]
               [-preserve_fid] [-fid FID]
               [-spat xmin ymin xmax ymax] [-wrapdateline]
               [-clipsrc [xmin ymin xmax ymax]|WKT|datasource|spat_extent] 
               [-clipsrcsql sql_statement] [-clipsrclayer layer] 
               [-clipsrcwhere expression]
               [-clipdst [xmin ymin xmax ymax]|WKT|datasource]
               [-clipdstsql sql_statement] [-clipdstlayer layer] 
               [-clipdstwhere expression]
               [-a_srs srs_def] [-t_srs srs_def] [-s_srs srs_def]
               [-f format_name] [-overwrite] [[-dsco NAME=VALUE] ...]
               [-segmentize max_dist] [-fieldTypeToString All|(type1[,type2]*)]
               dst_datasource_name src_datasource_name
               [-lco NAME=VALUE] [-nln name] [-nlt type] [layer [layer ...]]

 -f format_name: output file format name, possible values are:
     -f "ESRI Shapefile"
     -f "MapInfo File"
     -f "TIGER"
     -f "S57"
     -f "DGN"
     -f "Memory"
     -f "BNA"
     -f "CSV"
     -f "GML"
     -f "GPX"
     -f "KML"
     -f "GeoJSON"
     -f "Interlis 1"
     -f "Interlis 2"
     -f "GMT"
     -f "SQLite"
     -f "ODBC"
     -f "PostgreSQL"
     -f "MySQL"
     -f "DXF"
     -f "Geoconcept"
     -f "GeoRSS"
     -f "GPSTrackMaker"
 -append: Append to existing layer instead of creating new if it exists
 -overwrite: delete the output layer and recreate it empty
 -update: Open existing output datasource in update mode
 -progress: Display progress on terminal. Only works if input layers have the 
                                          "fast feature count" capability
 -select field_list: Comma-delimited list of fields from input layer to
                     copy to the new layer (defaults to all)
 -where restricted_where: Attribute query (like SQL WHERE)
 -wrapdateline: split geometries crossing the dateline meridian
                (long. = +/- 180deg)
 -sql statement: Execute given SQL statement and save result.
 -dialect value: select a dialect, usually OGRSQL to avoid native sql.
 -skipfailures: skip features or layers that fail to convert
 -gt n: group n features per transaction (default 200)
 -spat xmin ymin xmax ymax: spatial query extents
 -segmentize max_dist: maximum distance between 2 nodes.
                       Used to create intermediate points
 -dsco NAME=VALUE: Dataset creation option (format specific)
 -lco  NAME=VALUE: Layer creation option (format specific)
 -nln name: Assign an alternate name to the new layer
 -nlt type: Force a geometry type for new layer.  One of NONE, GEOMETRY,
      POINT, LINESTRING, POLYGON, GEOMETRYCOLLECTION, MULTIPOINT,
      MULTIPOLYGON, or MULTILINESTRING.  Add "25D" for 3D layers.
      Default is type of source layer.
 -fieldTypeToString type1,...: Converts fields of specified types to
      fields of type string in the new layer. Valid types are : Integer,
      Real, String, Date, Time, DateTime, Binary, IntegerList, RealList,
      StringList. Special value All will convert all fields to strings.
 -a_srs srs_def: Assign an output SRS
 -t_srs srs_def: Reproject/transform to this SRS on output
 -s_srs srs_def: Override source SRS

 Srs_def can be a full WKT definition (hard to escape properly),
 or a well known definition (ie. EPSG:4326) or a file with a WKT
 definition.</ows:ExceptionText>
  </ows:Exception>
</ows:ExceptionReport>


Specifiche dell'installazione:
  • Ubuntu Server 12.04
  • JRE 1.6.0_45 (Oracle)
  • GeoServer 2.3.1
  • GDAL 1.7.3 (con apt-get)
  • ogr-2.3.1.jar
Configurazione plugin OGR:
(però non funziona nemmeno con la configurazione di default, senza xml di configurazione)

<OgrConfiguration>
  <ogr2ogrLocation>ogr2ogr</ogr2ogrLocation>
  <gdalData>/usr/share/gdal/1.7/</gdalData>
  <formats>
    <Format>
      <ogrFormat>GPX</ogrFormat>
      <formatName>GPX</formatName>
      <fileExtension>.gpx</fileExtension>
      <!--<option>-a_srs EPSG:4326</option>
      <option>-dsco GPX_USE_EXTENSIONS=YES</option>
      <option>-skipfailures</option>
      <option>-nlt LINESTRING</option>-->
      <singleFile>true</singleFile>
      <mimeType>application/x-gpx+xml</mimeType>
    </Format>
    <Format>
      <ogrFormat>KML</ogrFormat>
      <formatName>OGR-KML</formatName>
      <fileExtension>.kml</fileExtension>
      <singleFile>true</singleFile>
      <mimeType>application/vnd.google-earth.kml</mimeType>
    </Format>
  </formats>
</OgrConfiguration>


Ho la sensazione che mi sfugge qualcosa.. Qualche suggerimento?

geo-saluti

- Milan


--
Hai ricevuto questo messaggio perché sei iscritto al gruppo "GeoServer Italia" di Google Gruppi.
Per annullare l'iscrizione a questo gruppo e non ricevere più i suoi messaggi, invia un'email a geoserver-it...@googlegroups.com.
Per postare messaggi in questo gruppo, invia un'email a geoser...@googlegroups.com.
Visita questo gruppo all'indirizzo http://groups.google.com/group/geoserver-ita?hl=it.
Per ulteriori opzioni, visita https://groups.google.com/groups/opt_out.
 
 

Milan P. Antonovic

unread,
May 16, 2013, 10:08:45 AM5/16/13
to geoser...@googlegroups.com
Ciao Tobia,
Grazie per l'aiuto. Il problema è in parte risolto..
Ho provato ad aggiornare gdal alla version 1.9. Ma il problema è rimasto.
Spulciando il codice sorgente dell'estensione ho intuito che le opzioni di configurazione del file ogr2ogr.xml devono essere separate. Ecco un esempio:

Configurazione sbagliata:

(...)
    <Format>
      <ogrFormat>GPX</ogrFormat>
      <formatName>GPX</formatName>
      <fileExtension>.gpx</fileExtension>
      <option>-dsco GPX_USE_EXTENSIONS=YES</option>
      <option>-skipfailures</option>
      <option>-nlt LINESTRING</option>
      <singleFile>true</singleFile>
      <mimeType>application/x-gpx+xml</mimeType>
    </Format>
(...)

Configurazione corretta:

(...)
    <Format>
      <ogrFormat>GPX</ogrFormat>
      <formatName>GPX</formatName>
      <fileExtension>.gpx</fileExtension>
      <option>-dsco</option>
      <option>GPX_USE_EXTENSIONS=YES</option>
      <option>-skipfailures</option>
      <option>-nlt</option>
      <option>LINESTRING</option>
      <singleFile>true</singleFile>
      <mimeType>application/x-gpx+xml</mimeType>
    </Format>
(...)

E qui ha cominciato a funzionare, unica pecca.. nel momento del salvataggio il nome del file scaricato è "null".

Per il resto va bene.

geo-saluti

Milan

Reply all
Reply to author
Forward
0 new messages