[GRASS-dev] How to import from a spatialite/sqlite db by v.in.ogr?

database can be downloaded here:

http://www.eea.europa.eu/data-and-maps/data/biogeographical-regions-europe-3

----
ogrinfo -al -so BiogeoRegions2016.sqlite
INFO: Open of `BiogeoRegions2016.sqlite'
      using driver `SQLite' successful.

Layer name: biogeoregions2016
Geometry: Multi Polygon
Feature Count: 12
Extent: (943611.000000, 600000.000000) - (8500000.000000, 7800000.000000)
Layer SRS WKT:
PROJCS["ETRS89 / LAEA Europe",
    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"]],
        AUTHORITY["EPSG","4258"]],
    PROJECTION["Lambert_Azimuthal_Equal_Area"],
    PARAMETER["latitude_of_center",52],
    PARAMETER["longitude_of_center",10],
    PARAMETER["false_easting",4321000],
    PARAMETER["false_northing",3210000],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AUTHORITY["EPSG","3035"]]
FID Column = PK_UID
Geometry Column = geometry
short_name: String (0.0)
pre_2012: String (0.0)
code: String (0.0)
name: String (0.0)
----

test which layer are in the db:

----
v.in.ogr -l input=BiogeoRegions2016.sqlite
biogeoregions2016
Data source <BiogeoRegions2016.sqlite> (format 'SQLite') contains 1 layers:
----

a layer can be seen by v.in.ogr (see the messed output)

then try to import:

----
v.in.ogr input=BiogeoRegions2016.sqlite layer=biogeoregions2016|geometry
output=test where=short_name = 'alpine'
ERROR: Layer <biogeoregions2016^^^|geometry> not available
----

it seems the geometry column of the can't be found by v.in.ogr.

but trying:

----
ogr2ogr -where "short_name = 'alpine'" test.shp BiogeoRegions2016.sqlite
----

works without any problems.

tested with

System Info
GRASS version: 7.3.svn
GRASS SVN revision: r70874M
Build date: 2017-04-15
Build platform: x86_64-w64-mingw32
GDAL: 2.1.3
PROJ.4: 4.9.3
GEOS: 3.5.0
SQLite: 3.17.0
Python: 2.7.5
wxPython: 2.8.12.1
Platform: Windows-8-6.2.9200 (OSGeo4W)

any ideas?

-----
best regards
Helmut
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/How-to-import-from-a-spatialite-sqlite-db-by-v-in-ogr-tp5317435.html
Sent from the Grass - Dev mailing list archive at Nabble.com.

Hi,

2017-04-16 22:40 GMT+02:00 Helmut Kudrnovsky <hellik@web.de>:

v.in.ogr -l input=BiogeoRegions2016.sqlite
biogeoregions2016

[...]

Data source <BiogeoRegions2016.sqlite> (format 'SQLite') contains 1 layers:
v.in.ogr input=BiogeoRegions2016.sqlite layer=biogeoregions2016|geometry
output=test where=short_name = 'alpine'
ERROR: Layer <biogeoregions2016^^^|geometry> not available

why not

layer=biogeoregions2016

? Ma

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa

Martin Landa wrote

Hi,

2017-04-16 22:40 GMT+02:00 Helmut Kudrnovsky &lt;

hellik@

&gt;:

v.in.ogr -l input=BiogeoRegions2016.sqlite
biogeoregions2016

[...]

Data source

<BiogeoRegions2016.sqlite>
(format 'SQLite') contains 1 layers:

v.in.ogr input=BiogeoRegions2016.sqlite layer=biogeoregions2016|geometry
output=test where=short_name = 'alpine'
ERROR: Layer &lt;biogeoregions2016^^^|geometry&gt; not available

why not

layer=biogeoregions2016

as it seems to be (auto-)generated by v.in.ogr(-GUI)?

just filled in the GUI, then pressed run and that's the output ...

-----
best regards
Helmut
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/How-to-import-from-a-spatialite-sqlite-db-by-v-in-ogr-tp5317435p5317437.html
Sent from the Grass - Dev mailing list archive at Nabble.com.

Martin Landa wrote

Hi,

2017-04-16 22:40 GMT+02:00 Helmut Kudrnovsky &lt;

hellik@

&gt;:

v.in.ogr -l input=BiogeoRegions2016.sqlite
biogeoregions2016

[...]

Data source

<BiogeoRegions2016.sqlite>
(format 'SQLite') contains 1 layers:

v.in.ogr input=BiogeoRegions2016.sqlite layer=biogeoregions2016|geometry
output=test where=short_name = 'alpine'
ERROR: Layer &lt;biogeoregions2016^^^|geometry&gt; not available

why not

layer=biogeoregions2016

yes, the bioregions2016|geometry is autogenerated by the v.in.ogr-GUI!

tested the cmd on the command line without "|geometry"

C:\>v.in.ogr input=BiogeoRegions2016.sqlite layer=biogeoregions2016
output=testoncmdline where="short_name = 'alpine'"

Check if OGR layer <biogeoregions2016> contains polygons...
100%
WARNING: Width for column short_name set to 255 (was not specified by OGR),
         some strings may be truncated!
WARNING: Width for column pre_2012 set to 255 (was not specified by OGR),
         some strings may be truncated!
WARNING: Width for column code set to 255 (was not specified by OGR), some
         strings may be truncated!
WARNING: Width for column name set to 255 (was not specified by OGR), some
         strings may be truncated!
Importing 1 features (OGR layer <biogeoregions2016>)...
100%
-----------------------------------------------------
Registering primitives...
27 primitives registered
48947 vertices registered
Number of nodes: 27
Number of primitives: 27
Number of points: 0
Number of lines: 0
Number of boundaries: 27
Number of centroids: 0
Number of areas: -
Number of isles: -
-----------------------------------------------------
Cleaning polygons
-----------------------------------------------------
Breaking polygons...
Breaking polygons (pass 1: select break points)...
100%
Breaking polygons (pass 2: break at selected points)...
100%
-----------------------------------------------------
Removing duplicates...
100%
-----------------------------------------------------
Breaking boundaries...
100%
-----------------------------------------------------
Removing duplicates...
100%
-----------------------------------------------------
Cleaning boundaries at nodes...
100%
-----------------------------------------------------
Merging boundaries...
100%
-----------------------------------------------------
Removing dangles...
100%
-----------------------------------------------------
Building areas...
100%
27 areas built
27 isles built
Number of nodes: 27
Number of primitives: 27
Number of points: 0
Number of lines: 0
Number of boundaries: 27
Number of centroids: 0
Number of areas: 27
Number of isles: 27
-----------------------------------------------------
Removing bridges...
100%
-----------------------------------------------------
Registering primitives...
27 primitives registered
48947 vertices registered
Building areas...
100%
27 areas built
27 isles built
Attaching islands...
100%
Number of nodes: 27
Number of primitives: 27
Number of points: 0
Number of lines: 0
Number of boundaries: 27
Number of centroids: 0
Number of areas: 27
Number of isles: 27
-----------------------------------------------------
Finding centroids for OGR layer <biogeoregions2016>...
100%
-----------------------------------------------------
Writing centroids...
100%
-----------------------------------------------------
27 input polygons
Total area: 9.48235E+011 (27 areas)
-----------------------------------------------------
Copying features...
100%
Building topology for vector map <testoncmdline@vecdata>...
Registering primitives...
54 primitives registered
48974 vertices registered
Building areas...
100%
27 areas built
27 isles built
Attaching islands...
100%
Attaching centroids...
100%
Number of nodes: 27
Number of primitives: 54
Number of points: 0
Number of lines: 0
Number of boundaries: 27
Number of centroids: 27
Number of areas: 27
Number of isles: 27

it's imported correctly.

it's a GUI regression.

should I open a ticket?

-----
best regards
Helmut
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/How-to-import-from-a-spatialite-sqlite-db-by-v-in-ogr-tp5317435p5317439.html
Sent from the Grass - Dev mailing list archive at Nabble.com.

Helmut Kudrnovsky wrote

it's a GUI regression.

should I open a ticket?

ticket opened by https://trac.osgeo.org/grass/ticket/3333

3333 .... nice number :wink:

-----
best regards
Helmut
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/How-to-import-from-a-spatialite-sqlite-db-by-v-in-ogr-tp5317435p5317443.html
Sent from the Grass - Dev mailing list archive at Nabble.com.

Martin Landa wrote

Hi,

2017-04-16 22:40 GMT+02:00 Helmut Kudrnovsky &lt;

hellik@

&gt;:

v.in.ogr -l input=BiogeoRegions2016.sqlite
biogeoregions2016

[...]

Data source

<BiogeoRegions2016.sqlite>
(format 'SQLite') contains 1 layers:

v.in.ogr input=BiogeoRegions2016.sqlite layer=biogeoregions2016|geometry
output=test where=short_name = 'alpine'
ERROR: Layer &lt;biogeoregions2016^^^|geometry&gt; not available

why not

layer=biogeoregions2016

? Ma

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa
_______________________________________________
grass-dev mailing list

grass-dev@.osgeo

https://lists.osgeo.org/mailman/listinfo/grass-dev

The more complete bug report is in:

https://trac.osgeo.org/grass/ticket/3308

-----
best regards
Helmut
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/How-to-import-from-a-spatialite-sqlite-db-by-v-in-ogr-tp5317435p5317469.html
Sent from the Grass - Dev mailing list archive at Nabble.com.