SOSICON web app

Exiting new web technologies bring Sosicon to your web browser at near native speed.

Forget about the cumbersome command-line interface. You no longer have to install Sosicon on your computer to enjoy swift file conversion from SOSI to Shapefile.

All you have to do is to visit app.sosicon.espenandersen.no. Load your SOSI file and get the result set on the fly within your browser.

None of your data will be uploaded to the server, the entire process takes place in a WebAssembly version of Sosicon, running locally on your own device. I only collect statistical information about file sizes, timing and whether the conversion failed or succeeded.

As for sosicon itself, the source behind the web application is also completely open for anyone to investigate.

The resulting Shapefiles can be downloaded directly from the web page after conversion.

Of course, there are memory limitations for applications running in the browser’s sandboxed environment. These constraints may vary, but they tend to be very strict on mobile devices.

Smaller file sizes (a couple of megabytes) should work well with most modern mobile devices. However, converting larger SOSI files should be done on a laptop/desktop client. File sizes over 50-70 Mb tend to fail in any circumstance. That’s when you need to revert to the original, installed version of Sosicon.

For the time being, the online version only supports Shapefile conversions. I may implement PostGIS support at a later time.

Enjoy!

Converting exceptionally large SOSI files to PostGIS

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

PostGIS

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

Export selected

A single SOSI file may contain several types of objects and geometry types. By default, Sosicon converts everything contained in the source file. It either writes the result to a large number of destination files in case of Shapefile export, or creates one very large SQL file in case of PostgreSQL/PostGIS export.

If you only want a pre-defined subset of features exported from the SOSI source, you can use the -t and -g options to restrict the conversion. On large SOSI files, this will save both time and storage space.

Continue reading Export selected

Data example

High-quality maps can be downloaded from the home page of the Norwegian Mapping Authority. You can get the SOSI files for the nation-wide N500 map here.

The N500 package consists of several SOSI files, each representing a set of various geographical features. One SOSI file may contain a multitude of geometries and object types. However, Shapefiles can contain no more than one geometry type each (typically polygons, polylines or points). Hence, one SOSI file may generate several Shapefiles, as individual geometries and object types are singled out and exported to separate Shapefile layers.

Continue reading Data example