1 2#------------------------------------------------------------------------------ 3# $File: sosi,v 1.2 2021/02/23 00:51:10 christos Exp $ 4# SOSI 5# Summary: Systematic Organization of Spatial Information 6# Long description: Norwegian text based map format 7# File extension: .sos 8# Full name: Petter Reinholdtsen (pere@hungry.com) 9# Reference: https://en.wikipedia.org/wiki/SOSI 10# 11# Example SOSI files available from 12# https://trac.osgeo.org/gdal/ticket/3638 13# https://nedlasting.geonorge.no/geonorge/Basisdata/N50Kartdata/SOSI/ 14# https://nedlasting.geonorge.no/geonorge/Samferdsel/Elveg/SOSI/ 15# 16# Start with optional comments (from "!" to the next line end) 17# followed by ".HODE" and end with "\n.SLUTT" followed by an optional 18# separator (any number of " ", "\t", "\n" or "\r"), might have BOM at 19# the start and following ".HODE" near the start there is "..OMR=C3=85DE" 20# (either UTF-8, ISO-8859-1 or some 7 bit Norwegian charset based on 21# ASCII) , "..TRANSPAR", "..TEGNSETT " followed by the charset and a 22# separator, as well as "..SOSI-VERSJON " followed by the format 23# version and a separator. 24# 25# FIXME figure out how to accept any of [space], [tab], [newline] and 26# [carriage return] as separators, not only line end. 27 28# Not searching for full "OMR=C3=85DE" to match also for non-UTF-8 29# character sets 300 search ..OMR 31>0 search ..TRANSPAR 32>>0 search .HODE SOSI map data 33>>>&0 search ..SOSI-VERSJON 34>>>>&1 string x \b, version %s 35# FIXME could not figure out way to make a match for .SLUTT at the end required 36#>-7 string \n.SLUTT slutt 37#>-8 string \n.SLUTT\n slutt-nl 38#>-9 string \n.SLUTT\r\n slutt-crnl2 39!:mime text/vnd.sosi 40!:ext sos 41