db_conn.execute('create table my_points (pnt_id integer primary key,name text)')
db_conn.execute("select gpkgAddGeometryColumn('my_points','the_geom','POINT',0,0,26912)")
db_conn.execute("select gpkgAddGeometryTriggers('my_points','the_geom')")
db_conn.execute("select gpkgAddSpatialIndex('my_points','the_geom')")
db_conn.execute("insert into my_points(name,Shape) values ('use gpkgMakePoint',gpkgMakePoint(419831.339,5161289.04))")
db_conn.execute('drop table my_points')
db_conn.execute("delete from gpkg_extensions where table_name='my_points'")db_conn.execute("create table my_points (OBJECTID integer primary key,name text,the_geom Point)")
db_conn.execute("select gpkgAddGeometryTriggers('my_points','the_geom')")db_conn.execute("insert into my_points(name,Shape) values ('use gpkgMakePoint',gpkgMakePoint(419831.339,5161289.04,26912))")
Enter code here...#import sqlite3
import apsw
import timenow = time.asctime(time.localtime(time.time()))# settting up the database connectiondb_conn_all.enableloadextension(True)
db_conn_all.loadextension('mod_spatialite')
db_conn = db_conn_all.cursor()
# setting up GeoPackage pragma
db_conn.execute('select gpkgCreateBaseTables()')# Making a spatial table
db_conn.execute('create table my_points (pnt_id integer primary key,name text)')
db_conn.execute("select gpkgAddGeometryColumn('my_points','the_geom','POINT',0,0,26912)")
db_conn.execute("select gpkgAddGeometryTriggers('my_points','the_geom')")
db_conn.execute("select gpkgAddSpatialIndex('my_points','the_geom')")
# try inserting into the gpkg_contents table
# the ESRI create feature class puts an entry in this table that the Spatialite function does notdb_conn.execute("insert into gpkg_contents (table_name,data_type,identifier,description,last_change,min_x,min_y,max_x,max_y,srs_id) values ('my_points','features','my_points',NULL,'2015-04-22T14:58:01.000Z',NULL,NULL,NULL,NULL,26912)")
# Change the DDL to use the geometry data type
db_conn.execute('drop table my_points')
db_conn.execute("delete from gpkg_extensions where table_name='my_points'")
db_conn.execute("create table my_points (OBJECTID integer primary key,name text,the_geom POINT)")
db_conn.execute("select gpkgAddGeometryTriggers('my_points','the_geom')")
# add the SRID
db_conn.execute('select gpkgInsertEpsgSRID(26912)')
# add some data
for x_coor in range(419830,419890,10):
for y_coor in range(5161230,5161290,10):
db_conn.execute("insert into my_points(name,the_geom) values ('use gpkgMakePoint',gpkgMakePoint(?,?,?))",[x_coor,y_coor,26912])
select gpkgCreateBaseTables();
create table my_points (pnt_id integer primary key,name text)
;
select gpkgAddGeometryColumn('my_points','the_geom','POINT',0,0,4326)
;--
You received this message because you are subscribed to the Google Groups "SpatiaLite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to spatialite-use...@googlegroups.com.
To post to this group, send email to spatiali...@googlegroups.com.
Visit this group at http://groups.google.com/group/spatialite-users.
For more options, visit https://groups.google.com/d/optout.
select gpkgAddGeometryTriggers('my_points','the_geom');
select * from sqlite_master where name='my_points';
0 pnt_id integer 0 NULL 1
1 name text 0 NULL 0
2 the_geom POINT 0 NULL 0
select gpkgAddGeometryColumn('my_points','the_geom','POINT’, 1 ,0,26912)
select gpkgAddGeometryColumn('geometrycollection_gpkg','geometry','GEOMCOLLECTION',0,0,4326);
gpkgMakePoint (x Double precision , y Double precision , srid Integer )