Sosicon has the ability to assemble several SOSI source files into one large SQL file. However, the maximum size of the destination file depends on the target machine’s memory resources. Sometimes, the data source is too large for a single-run approach and you will run out of memory.
Fortunately, there is an easy workaround to avoid memory exhaustion. You will have to build the database creation script (DDL statements) separately, and then split up your insertion script (SQL statements) across multiple SQL files. That is quite easily accomplished with the -create and -insert parameters.
Continue reading Converting exceptionally large SOSI files to PostGIS
Here’s an example on how to convert and import SOSI map data into PostgreSQL/PosGIS using Sosicon, then opening it in Mapbox’ design studio TileMill.
We are going to use the landcover SOSI file “NO_N250_Arealdekke.sos” from the N250 SOSI package provided for free by the Norwegian Mapping Authority.
Continue reading Get SOSI into PostGIS and TileMill
SOSI files may be converted to a PosgreSQL/PostGIS dump file for easy database import. The content of related SOSI elements are exported alongside the geometry.
The following command will create an sql file for PostGIS from, let’s say 32_1244Adresse.sos:
sosicon -2psql 32_1244Adresse.sos
The default file name for the export file is postgis_dump.sql. Run it in psql to create the schema and the points table. A database schema called sosicon will be created in the active database, and in it the table object_point is created and filled with the exported SOSI data points. If there are several geometry types in the SOSI files, one table is created for each geometry. The table names are postfixed with the relevant geometry name, i.e. “object_point”, “object_linestring” or “object_polygon”.
Use the -o parameter to specify a different output file name. To specify custom schema or table name, use -schema and -table:
sosicon -2psql -schema municipalities -table austevoll -o austevoll.sql 32_1244Adresse.sos
This vil output austevoll.sql. When imported in PostGIS, the data will be stored in table austevoll_[XXX] within schema municipalities, where [XXX] is the geometry name.
Continue reading PostGIS