[GRASS-dev] [GRASS GIS] #2702: G7: vector vrt not recognized by "v.in.ogr - import common formats"/can't be opened

#2702: G7: vector vrt not recognized by "v.in.ogr - import common formats"/can't
be opened
-------------------------+---------------------------------
Reporter: hellik | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.1
Component: Default | Version: svn-releasebranch70
Keywords: | CPU: Unspecified
Platform: Unspecified |
-------------------------+---------------------------------
given a vector vrt (referring to a point csv):

{{{
ogrinfo gbif_to_gis_working.vrt
INFO: Open of `gbif_to_gis_working.vrt'
       using driver `VRT' successful.
1: gbif_gisinput (Point)
}}}

{{{
INFO: Open of `gbif_to_gis_working.vrt'
       using driver `VRT' successful.

Layer name: gbif_gisinput
Geometry: Point
Feature Count: 182
Extent: (0.000000, 0.000000) - (13.240250, 47.282780)
Layer SRS WKT:
GEOGCS["WGS 84",
     DATUM["WGS_1984",
         SPHEROID["WGS 84",6378137,298.257223563,
             AUTHORITY["EPSG","7030"]],
         TOWGS84[0,0,0,0,0,0,0],
         AUTHORITY["EPSG","6326"]],
     PRIMEM["Greenwich",0,
         AUTHORITY["EPSG","8901"]],
     UNIT["degree",0.0174532925199433,
         AUTHORITY["EPSG","9108"]],
     AUTHORITY["EPSG","4326"]]
gbifid: String (0.0)
xdatasetkey: String (0.0)
occurrenceid: String (0.0)
kingdom: String (0.0)
phylum: String (0.0)
xclass: String (0.0)
xorder: String (0.0)
family: String (0.0)
genus: String (0.0)
species: String (0.0)
infraspecificepithet: String (0.0)
taxonrank: String (0.0)
scientificname: String (0.0)
countrycode: String (0.0)
locality: String (0.0)
publishingorgkey: String (0.0)
decimallatitude: String (0.0)
decimallongitude: String (0.0)
elevation: String (0.0)
elevationaccuracy: String (0.0)
depth: String (0.0)
depthaccuracy: String (0.0)
eventdate: String (0.0)
xday: String (0.0)
xmonth: String (0.0)
xyear: String (0.0)
taxonkey: String (0.0)
specieskey: String (0.0)
basisofrecord: String (0.0)
institutioncode: String (0.0)
collectioncode: String (0.0)
catalognumber: String (0.0)
recordnumber: String (0.0)
identifiedby: String (0.0)
rights: String (0.0)
rightsholder: String (0.0)
recordedby: String (0.0)
typestatus: String (0.0)
establishmentmeans: String (0.0)
lastinterpreted: String (0.0)
mediatype: String (0.0)
issue: String (0.0)
}}}

{{{
OGRFeature(gbif_gisinput):4
   gbifid (String) = 684164905
   xdatasetkey (String) = 7b904404-f762-11e1-a439-00145eb45e9a
   occurrenceid (String) =
   kingdom (String) = Plantae
   phylum (String) = Magnoliophyta
   xclass (String) = Magnoliopsida
   xorder (String) = Asterales
   family (String) = Asteraceae
   genus (String) = Jacobaea
   species (String) = Jacobaea incana
   infraspecificepithet (String) =
   taxonrank (String) = SPECIES
   scientificname (String) = Senecio carniolicus Willd.
   countrycode (String) = AT
   locality (String) = Aufstieg Roßtal (Maxer Lek) - Kalksteiner Jöchl
   publishingorgkey (String) = f9912a00-84a9-11d9-8952-b8a03c50a862
   decimallatitude (String) = 46.82056
   decimallongitude (String) = 12.29528
   elevation (String) = 2175.0
   elevationaccuracy (String) = 175.0
   depth (String) =
   depthaccuracy (String) =
   eventdate (String) = 2001-08-13T00:00Z
   xday (String) = 13
   xmonth (String) = 8
   xyear (String) = 2001
   taxonkey (String) = 6064702
   specieskey (String) = 5388625
   basisofrecord (String) = HUMAN_OBSERVATION
   institutioncode (String) = TLMF
   collectioncode (String) = Tiroler Landesmuseum Ferdinandeum
   catalognumber (String) = 1AD3DA9D-845D-4432-8A78-8527951513C9
   recordnumber (String) =
   identifiedby (String) =
   rights (String) =
   rightsholder (String) =
   recordedby (String) = Polatschek A.
   typestatus (String) =
   establishmentmeans (String) =
   lastinterpreted (String) = 2014-06-05T14:10Z
   mediatype (String) =
   issue (String) = COORDINATE_ROUNDED;GEODETIC_DATUM_ASSUMED_WGS84
   POINT (12.29528 46.82056)
}}}

ogrinfo gives the right infos about the point vector.

{{{
v.in.ogr -f
Supported formats:
  ESRI Shapefile (rw): ESRI Shapefile
[...]
  VRT (ro): VRT
[...]
}}}

(1) the "v.in.ogr - import common formats"-GUI seems not to recognize the
vrt format:

open this special GUI, insert the path to the vrt, only a shape file in
this file is recognized, but not the vector vrt

(2) open v.in.ogr --ui:

{{{
v.in.ogr -l
input=C:\tmp\0000402-150615163101818_senecio_carniolicus\gbif_to_gis_working.vrt
output=check4
gbif_gisinput
ERROR 1: Failed to open datasource `gbif_gisinput.csv'.
Data source
<C:\tmp\0000402-150615163101818_senecio_carniolicus\gbif_to_gis_working.vrt>
(format 'VRT') contains 1 layers:
}}}

{{{
v.in.ogr
input=C:\tmp\0000402-150615163101818_senecio_carniolicus\gbif_to_gis_working.vrt
output=check5
ERROR 1: Failed to open datasource `gbif_gisinput.csv'.
Check if OGR layer <gbif_gisinput> contains polygons...
Importing 0 features (OGR layer <gbif_gisinput>)...
-----------------------------------------------------
Erstelle Topologie für die Vektorkarte <check5@newcheck>...
Registriere Primitive...
0 primitives registered
0 Vertices registriert
Erzeuge Flächen...
0 areas built
0 isles built
Füge Inseln hinzu...
Füge Zentroide hinzu...
Anzahl der Knoten: 0
Anzahl der Primitive: 0
Anzahl der Punkte: 0
Anzahl der Linien: 0
Anzahl der Grenzen: 0
Anzahl der Zentroide: 0
Anzahl der Flächen: 0
Anzahl der Inseln: 0
}}}

any idea?

(vrt and csv attached to ticket)

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2702&gt;
GRASS GIS <http://grass.osgeo.org>

#2702: G7: vector vrt not recognized by "v.in.ogr - import common formats"/can't
be opened
--------------------------+---------------------------------
  Reporter: hellik | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.0.1
Component: Default | Version: svn-releasebranch70
Resolution: | Keywords:
       CPU: Unspecified | Platform: Unspecified
--------------------------+---------------------------------
Changes (by hellik):

* Attachment "gbif_to_gis_working.vrt" added.

vrt

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2702&gt;
GRASS GIS <http://grass.osgeo.org>

#2702: G7: vector vrt not recognized by "v.in.ogr - import common formats"/can't
be opened
--------------------------+---------------------------------
  Reporter: hellik | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.0.1
Component: Default | Version: svn-releasebranch70
Resolution: | Keywords:
       CPU: Unspecified | Platform: Unspecified
--------------------------+---------------------------------
Changes (by hellik):

* Attachment "gbif_gisinput.csv" added.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2702&gt;
GRASS GIS <http://grass.osgeo.org>

#2702: G7: vector vrt not recognized by "v.in.ogr - import common formats"/can't
be opened
--------------------------+---------------------------------
  Reporter: hellik | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.0.1
Component: Default | Version: svn-releasebranch70
Resolution: | Keywords:
       CPU: Unspecified | Platform: Unspecified
--------------------------+---------------------------------

Comment (by mlennert):

The problem is simply the path to the csv file. In your vrt you have:

<SrcDataSource>gbif_gisinput.csv</SrcDataSource>

which (IIUC) means that v.in.ogr will search for the csv file in the CWD,
not in the same directory as the vrt file.

So either use an absolute path, or cd to the directory in which the two
files are and then launch v.in.ogr.

Leaving the ticket open for you to confirm that this is the issue.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2702#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

#2702: G7: vector vrt not recognized by "v.in.ogr - import common formats"/can't
be opened
--------------------------+---------------------------------
  Reporter: hellik | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.0.1
Component: Default | Version: svn-releasebranch70
Resolution: | Keywords:
       CPU: Unspecified | Platform: Unspecified
--------------------------+---------------------------------

Comment (by mlennert):

Or you can change the line to:

<SrcDataSource relativeToVRT=1>gbif_gisinput.csv</SrcDataSource>

and then it works, whatever your CWD, as long as the csv file is in the
correct relative position to the vrt file (in this case in the same
directory).

BTW: I have no problems using the wxgui import wizard to import this vrt.
Have you made sure that the wizard file picker was not configured to only
look for shapefiles ?

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2702#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>

#2702: G7: vector vrt not recognized by "v.in.ogr - import common formats"/can't
be opened
--------------------------+---------------------------------
  Reporter: hellik | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.0.1
Component: Default | Version: svn-releasebranch70
Resolution: | Keywords:
       CPU: Unspecified | Platform: Unspecified
--------------------------+---------------------------------

Comment (by hellik):

Replying to [comment:2 mlennert]:
> Or you can change the line to:
>
> <SrcDataSource relativeToVRT=1>gbif_gisinput.csv</SrcDataSource>
>
> and then it works, whatever your CWD, as long as the csv file is in the
correct relative position to the vrt file (in this case in the same
directory).

yes, adding relativeToVRT=1 does the trick (will change the title of the
ticket)

>
> BTW: I have no problems using the wxgui import wizard to import this
vrt. Have you made sure that the wizard file picker was not configured to
only look for shapefiles ?

here the vrt is recognized by the vector import wizard if I explicitely
choose the vrt file.

in mode "source type: directory; format: vrt": if I enter the path to
directory, only the shapefile in this folder is recognized, although vrt
is defined as format.

{{{
System Info
GRASS version: 7.1.svn
GRASS SVN revision: 65544
Build date: 2015-07-09
Build platform: i686-pc-mingw32
GDAL: 1.11.2
PROJ.4: 4.8.0
GEOS: 3.4.2
SQLite: 3.7.17
Python: 2.7.4
wxPython: 2.8.12.1
Platform: Windows-7-6.1.7601-SP1 (OSGeo4W)
}}}

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2702#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>

#2702: G7: vector vrt not recognized by "v.in.ogr - import common formats" by mode
directory
--------------------------+---------------------------------
  Reporter: hellik | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.0.1
Component: Default | Version: svn-releasebranch70
Resolution: | Keywords:
       CPU: Unspecified | Platform: Unspecified
--------------------------+---------------------------------

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2702#comment:4&gt;
GRASS GIS <http://grass.osgeo.org>