what is the correct way to import a spatialite db into trunk?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

what is the correct way to import a spatialite db into trunk?

Helmut Kudrnovsky
given a shapefile translated to a spatialite db:

ogr2ogr -f "SQLITE" testshape.sqlite testshape.shp -dsco SPATIALITE=YES

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

Layer name: testshape
Geometry: Polygon
Feature Count: 1
Extent: (16.709875, 47.783588) - (16.826881, 47.911541)
Layer SRS WKT:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0,
        AUTHORITY["EPSG","8901"]],
    UNIT["degree",0.0174532925199433,
        AUTHORITY["EPSG","9122"]],
    AUTHORITY["EPSG","4326"]]
FID Column = OGC_FID
Geometry Column = GEOMETRY
cat: Integer (0.0)
test: Integer (0.0)
OGRFeature(testshape):1
  cat (Integer) = 1
  test (Integer) = 1
  POLYGON ((16.79321008613654 47.911540344688355,16.826880116934124 47.783594227
657538,16.709876759912522 47.784435978427481,16.79321008613654 47.91154034468835
5))

then:

v.in.ogr --ui

Source type file:

v.in.ogr -l input=C:\tmp\newaddons\testsqlite\gg\testshape.sqlite layer=testshape|GEOMETRY
Data source <C:\tmp\newaddons\testsqlite\gg\testshape.sqlite> (format 'SQLite') contains 1 layers:
testshape

v.in.ogr input=C:\tmp\newaddons\testsqlite\gg\testshape.sqlite layer=testshape|GEOMETRY output=t1
ERROR: Layer <testshape^^^|GEOMETRY> not available

Source type database:

=> input layer id marked, but input not reckognized

v.in.ogr input=<required> layer=testshape|GEOMETRY output=t2

GRASS version: 7.1.svn                                                          
GRASS SVN revision: 66855                                                      
Build date: 2015-11-18                                                          
Build platform: i686-pc-mingw32                                                
GDAL: 1.11.3                                                                    
PROJ.4: 4.8.0                                                                  
GEOS: 3.5.0                                                                    
SQLite: 3.7.17                                                                  
Python: 2.7.4                                                                  
wxPython: 2.8.12.1                                                              
Platform: Windows-7-6.1.7601-SP1 (OSGeo4W)    

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

let's test it in 7.0.2RC2

v.in.ogr --ui

v.in.ogr -l input=C:\tmp\newaddons\testsqlite\gg\testshape.sqlite              
testshape
Data source <C:\tmp\newaddons\testsqlite\gg\testshape.sqlite> (format 'SQLite') contains 1 layers:

Selection tab => not geometry column choosable

v.in.ogr input=C:\tmp\newaddons\testsqlite\gg\testshape.sqlite output=t3        
Check if OGR layer <testshape> contains polygons...
Column name <cat> renamed to <cat_>
Importing 1 features (OGR layer <testshape>)...
-----------------------------------------------------
Registering primitives...
One primitive registered
4 vertices registered
Number of nodes: 1
[...]
-----------------------------------------------------
Finding centroids for OGR layer <testshape>...
-----------------------------------------------------
Writing centroids...
-----------------------------------------------------
1 input polygons
Total area: 6.21962E+007 (1 areas)
-----------------------------------------------------
Copying features...
WARNING: Unable to delete file 'C:\grassdata/srtm41gar/test/.tmp/unknown/vector/tmp_7840/coor'
Building topology for vector map <t3@test>...
Registering primitives...
2 primitives registered
5 vertices registered
Building areas...
One area built
One isle built
Attaching islands...
Attaching centroids...
Number of nodes: 1
Number of primitives: 2
Number of points: 0
Number of lines: 0
Number of boundaries: 1
Number of centroids: 1
Number of areas: 1
Number of isles: 1
(Wed Nov 18 22:10:06 2015) Command finished (8 sec)  
---------------

any ideas to how to import a spatialite db into trunk?
best regards
Helmut
Reply | Threaded
Open this post in threaded view
|

Re: what is the correct way to import a spatialite db into trunk?

Helmut Kudrnovsky
Helmut Kudrnovsky wrote
any ideas to how to import a spatialite db into trunk?
ah ok, with v.in.ogr-import wizzard it works, the command in trunk for importing a spatialite db seems to be:

v.in.ogr input=C:\tmp\newaddons\testsqlite\gg\testshape.sqlite layer=testshape output=testshape geometry=GEOMETRY
WARNING: Option <geometry> will be ignored. OGR doesn't support it for selected format (SQLite).
Check if OGR layer <testshape> contains polygons...
Column name <cat> renamed to <cat_>
Importing 1 features (OGR layer <testshape>)...
[...]

so it still open the question how to use it in v.in.ogr --ui?
best regards
Helmut