Skip to content

Instantly share code, notes, and snippets.

View gacarrillor's full-sized avatar

Germap gacarrillor

View GitHub Profile
germap@germap-pc /docs/dev/LADM_COL $ java -jar /docs/downloads/software/ili2gpkg-3.10.5/ili2gpkg.jar --schemaimport --dbfile /docs/borrar/gpkg/ladm_col16.gpkg --createFk --trace /docs/dev/LADM_COL/Catastro_COL_ES.ili
Info: dburl <jdbc:sqlite:/docs/borrar/gpkg/ladm_col16.gpkg>
Info: dbusr <>
Info: postConnect(): PRAGMA application_id=1196437808; (ch.ehi.ili2gpkg.GpkgMapping)
Info: postConnect(): CREATE TABLE gpkg_spatial_ref_sys ( srs_name TEXT NOT NULL, srs_id INTEGER NOT NULL PRIMARY KEY, organization TEXT NOT NULL, organization_coordsys_id INTEGER NOT NULL, definition TEXT NOT NULL, description TEXT); (ch.ehi.ili2gpkg.GpkgMapping)
Info: postConnect(): INSERT INTO gpkg_spatial_ref_sys ( srs_name, srs_id, organization, organization_coordsys_id, definition) VALUES ('WGS-84', 4326, 'EPSG', 4326, '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["E
@gacarrillor
gacarrillor / qgis_master_crash_transaction_groups.txt
Last active July 26, 2017 16:44
QGIS master crash with Transaction Groups enabled
src/providers/postgres/qgspostgresconn.cpp: 214: (QgsPostgresConn) [0ms] New PostgreSQL connection for dbname='test' host=localhost user='postgres' password='postgres'
src/providers/postgres/qgspostgresconn.cpp: 280: (QgsPostgresConn) [60ms] setting client encoding to UNICODE
src/providers/postgres/qgspostgresconn.cpp: 284: (QgsPostgresConn) [0ms] encoding successfully set
src/providers/postgres/qgspostgresconn.cpp: 295: (QgsPostgresConn) [0ms] Connection to the database was successful
src/providers/postgres/qgspostgresconn.cpp: 1378: (deduceEndian) [1ms] Creating binary cursor
src/providers/postgres/qgspostgresconn.cpp: 1383: (deduceEndian) [1ms] Fetching a record and attempting to get check endian-ness
src/providers/postgres/qgspostgresconn.cpp: 1393: (deduceEndian) [0ms] Got oid of 1259 from the binary cursor
src/providers/postgres/qgspostgresconn.cpp: 1394: (deduceEndian) [0ms] First oid is 1259
src/providers/postgres/qgspostgresconn.cpp: 852: (postgisVersion) [475ms] PostGIS version info: 2.3 USE_GEOS=1
@gacarrillor
gacarrillor / parse_ili_models.py
Created July 11, 2017 16:38
Parse ili model in search for domain attributes
import re
import glob
ilifile = '/docs/tr/ai/productos/curso_interlis_mayo_2017/ejercicio_3er_dia/modelos/LADM-OT-discusion.ili' #Catastro_COL_ES_V_2_0_20170331.ili'
domains = [
'Catastro_COL_ES_V_2_0_20170331.COL_Genero',
'Catastro_COL_ES_V_2_0_20170331.COL_InteresadoDocumentoTipo',
'Catastro_COL_ES_V_2_0_20170331.COL_InteresadoDocumentoTipo',
'Catastro_COL_ES_V_2_0_20170331.COL_UsoTipo',
'documentoOTTipo',
@gacarrillor
gacarrillor / layers_select.sql
Created April 20, 2017 13:06
isdomain field definition
SELECT
tbls.schemaname AS schemaname,
tbls.tablename AS tablename,
a.attname AS primary_key,
g.f_geometry_column AS geometry_column,
g.srid AS srid,
g.type AS type,
(cols.column_name = 'ilicode') AS isdomain
FROM pg_catalog.pg_tables tbls
LEFT JOIN pg_index i
def ogrLayerName(uri):
""" Returns layer name suitable for Gdal/OGR commands
"""
fields = uri.split('|')
ogruri = fields[0]
fields = fields[1:]
layerid = 0
for f in fields:
if f.startswith('layername='):
# Name encoded in uri, nothing more needed
@gacarrillor
gacarrillor / IterateLayersAndExportComposer.py
Created October 4, 2016 01:16
"Run" method of a QGIS test plugin to export a composer iterating layers inside a group and making them visible one at a time.
def run(self): # Run method of a QGIS plugin
ruta="/tmp/"
# The plugin Maps Printer is required!!!
mp = qgis.utils.plugins['MapsPrinter']
composer = self.iface.activeComposers()[0] # We'll only use the first composer
extension = '.png'
# Get the group to start iterating layers (making only 1 layer visible at a time)
group = QgsProject.instance().layerTreeRoot().findGroup( 'DEPTOS' )