|  | Commit message (Collapse) | Author | Age | Files | 
|---|
| | |  | 
| | |  | 
| | |  | 
| | 
| 
| 
| 
| | Among other things this allows CLUSTERing on the GIST indices, cf.
https://postgis.net/docs/manual-3.3/performance_tips.html#database_clustering | 
| | |  | 
| | |  | 
| | 
| 
| 
| 
| 
| | This avoids starting multiple imports in parallel.  Some layers, such as
Skogsstyrelsen's, are quite large and filtering/importing causes rather
high load. | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | Cf. for instance
	$ ogrinfo ./LST.vbk_projekteringsomraden.shp -sql "SELECT * FROM \"LST.vbk_projekteringsomraden\" WHERE OMRID = '1452-V-008'"
        […]
	Layer name: LST.vbk_projekteringsomraden
	Geometry: Polygon
	Feature Count: 1
	Extent: (-907106.000000, 727.000000) - (914131.738200, 7573766.311200)
	Layer SRS WKT:
	PROJCRS["SWEREF99 TM",
        […]
	OGRFeature(LST.vbk_projekteringsomraden):2043
	  OMRID (String) = 1452-V-008
	  PROJNAMN (String) = Grimsås Äspås
	  ANTALVERK (Integer64) = 0
	  AntalejXY (Integer64) = (null)
	  CALPROD (Real) = 0.000000000000000
	  PBYGGSTART (String) = (null)
	  PDRIFT (String) = (null)
	  Andringsan (String) = (null)
	  UnderByggn (String) = (null)
	  ORGNAMN (String) = Kraftö AB
	  ORGNR (String) = 556708-7456
	  EJAKTUELL (String) = Yes
	  KOMNAMN (String) = Tranemo
	  LANSNAMN (String) = Västra Götalands l
	  EL_NAMN (String) = (null)
	  Raderat (String) = No
	  ArendeStat (String) = (null) | 
| | 
| 
| 
| | The PostgreSQL driver doesn't support AlternativeName, for instance. | 
| | 
| 
| 
| | This is the case for the PGDump driver, for instance. | 
| | 
| 
| 
| 
| 
| 
| 
| 
| | OGRFieldDefn: add GetComment() / SetComment() methods were added in OGR
3.8.0, cf. https://github.com/OSGeo/gdal/blob/master/NEWS.md#core-3 .
Don't comment out TZ on field definitions.  Instead we check the
GDAL/OGR version and ignore TZ on field definitions if the OGR version
is too old. | 
| | |  | 
| | 
| 
| 
| 
| 
| 
| 
| 
| | OGRFieldDefn: add GetComment() / SetComment() methods were added in OGR
3.7.0, cf. https://github.com/OSGeo/gdal/blob/master/NEWS.md#core-5 .
Don't comment out comments on field definitions.  Instead we check the
GDAL/OGR version and ignore comments on field definitions if the OGR
version is too old. | 
| | |  | 
| | 
| 
| 
| 
| 
| 
| 
| 
| | This is useful to replace a YYYYMMDD formatted date with YYYY-MM-DD.
The target field can then be set to not-nullable and its type set to
Date, as the OGR_F_SetField*() with take care of the conversion.
We could also do that via an SQL query, but in our case the sources are
not proper RDBMS so SQL is emulated anyway. | 
| | |  | 
| | 
| 
| 
| | And set them to NULL. | 
| | 
| 
| 
| 
| | The previous default map was [-1] * n i.e., all source fields were
ignored. | 
| | |  | 
| | |  | 
| | 
| 
| 
| | This enables proper filtering by level etc. (incl. journald coloring). | 
| | 
| 
| 
| | (Commented out for now since Bookworm has only GDAL v3.6.) | 
| | 
| 
| 
| 
| 
| | Despite using gdal.UseExceptions() a failed call doesn't raise an
exception, so we need to check the return value to avoid missing
features. | 
| | |  | 
| | |  | 
| | |  | 
| | 
| 
| 
| 
| 
| | The extent is expressed in config['SRS'] in traditional GIS order
(easting/northing ordered: minX, minY, maxX, maxY), but the destination
layers might be pre-existing and use other SRS:es or mapping strategy. | 
| | |  | 
| | 
| 
| 
| 
| 
| | The configured extent is always expressed in the destination SRS, so it
needs to be transformed into the source SRS.  Like apps/ogr2ogr_lib.cpp,
we segmentize it to make sure it is sufficiently densified. | 
| | 
| 
| 
| | (Commented out in config.yml for now since Bookworm has only v3.6.) | 
| | |  | 
| | 
| 
| 
| | And getFieldSubTypeCode() to parseSubFieldType(). | 
|  | There is still a few things to do (such as reprojection and geometry
changes) but it's mostly working.
We roll out our own ogr2ogr/GDALVectorTranslate()-like function version
because GDALVectorTranslate() insists in calling StartTransaction()
https://github.com/OSGeo/gdal/issues/3403 while we want a single
transaction for the entire desination layer, including truncation,
source imports, and metadata changes.
Surprisingly our version is not much slower than the C++ one.  Importing
the 157446 (of 667034) features from sksUtfordAvverk-2000-2015.shp takes
14.3s while
	ogr2ogr -f PostgreSQL \
	    -doo ACTIVE_SCHEMA=postgis \
	    --config PG_USE_COPY YES \
	    --config OGR_TRUNCATE YES \
	    -append \
	    -fieldmap "0,-1,-1,-1,-1,1,2,3,4,5,6,7,8,9,10,11,12,13" \
	    -nlt MULTIPOLYGON -nlt PROMOTE_TO_MULTI \
	    -gt unlimited \
	    -spat 110720 6927136 1159296 7975712 \
	    -nln "sks:UtfordAvverk" \
	    PG:"dbname='webmap' user='webmap_import'" \
	    /tmp/x/sksUtfordAvverk-2000-2015.shp \
	    sksUtfordAvverk-2000-2015
takes 14s.
Merely opening /tmp/x/sksUtfordAvverk-2000-2015.shp and looping through
its (extent-filtered) features results in a runtime of 4.3s. |