You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
IOOptions options; // important options to connect to database
QUrl connectionString("postgresql://localhost:5432/ilwis-pg-test/tl_2010_us_rails");
Resource rails(connectionString,itCOVERAGE);
options.addOption("pg.password", "postgres");
options.addOption("pg.user", "postgres");
//options.addOption("pg.schema", "public"); // default// options.addOption("pg.features.order", "center,geom"); // declare order of geometries
IFeatureCoverage fcoverage;
fcoverage.prepare(rails,options);
fcoverage->connectTo(makeOutputPath("rails.shp"), "ESRI Shapefile", "gdal", IlwisObject::cmOUTPUT);
fcoverage->store(options);
The above code will load data from the database and store it back as ESRI Shape file. The data comes from the tl_2010_us_rails table in database ilwis-pg-test which is accessible from localhost and standard PostgreSQL port. As usual a resource with corresponding IlwisType is prepared with the user credentials set needed to access the database.
Details
The whole way of preparing and loading the data is like with other connectors. For PostgreSQL data sources one has to use the connection link as follows:
postgresql://<host>:<port>/<database>/<tablename>
tbd
Notes
Supported are flat feature tables
FeatureCoverage has CRS which was set for the first geometry column found
Postgresql Connector utilizes the geometry_columns table
multiple geometries are supported via ILWIS' track index