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.
Inspect file content
If the content of the SOSI file is unknown, use the -stat
operation to aggregate a list of elements in the SOSI file:
sosicon -stat Arealdekke.sos
One of the emitted lists gives an overview of OBJTYPEs embedded in the file, and may look something like this:
OBJTYPE : COUNT ------------------------------------------ Arealbrukgrense...............: 4671 DyrketMark....................: 170 ElvBekk.......................: 1290 ElvBekkKant...................: 199 FiktivDelelinje...............: 503 Innsjø........................: 369 Innsjøkant....................: 906 InnsjøkantRegulert............: 111 KantUtsnitt...................: 317 Kystkontur....................: 353 Myr...........................: 1155 Skog..........................: 608 SportIdrettPlass..............: 147 TettBebyggelse................: 144 Tregruppe.....................: 170 ÅpentOmråde...................: 770
Filter by OBJTYPE
The -t
option filters by SOSI OBJTYPE. You may provide one or more (comma separated) OBJTYPEs that you want to convert.
If you’re only after green areas like forests and parks (Skog, Park), run the following command:
sosicon -2shp -t "Skog, Park" Arealdekke.sos
Filter by geometry
You may also filter by geometry type. Use the SOSI geometry names to specify which feature types to export:
- KURVE (curve/polyline)
- FLATE (surface/polygon)
- PUNKT (point)
Use the -g option:
sosicon -2shp -g FLATE Arealdekke.sos