New SOSI magic from Petter Reinholdtsen
authorChristos Zoulas <christos@zoulas.com>
Mon, 20 May 2019 17:25:09 +0000 (17:25 +0000)
committerChristos Zoulas <christos@zoulas.com>
Mon, 20 May 2019 17:25:09 +0000 (17:25 +0000)
magic/Magdir/sosi [new file with mode: 0644]
magic/Makefile.am

diff --git a/magic/Magdir/sosi b/magic/Magdir/sosi
new file mode 100644 (file)
index 0000000..cfac5a3
--- /dev/null
@@ -0,0 +1,40 @@
+
+#------------------------------------------------------------------------------
+# $File: sosi,v 1.1 2019/05/20 17:25:09 christos Exp $
+# SOSI
+# Summary: Systematic Organization of Spatial Information
+# Long description: Norwegian text based map format
+# File extension: .sos
+# Full name:    Petter Reinholdtsen (pere@hungry.com)
+# Reference: https://en.wikipedia.org/wiki/SOSI
+#
+# Example SOSI files available from
+# https://trac.osgeo.org/gdal/ticket/3638
+# https://nedlasting.geonorge.no/geonorge/Basisdata/N50Kartdata/SOSI/
+# https://nedlasting.geonorge.no/geonorge/Samferdsel/Elveg/SOSI/
+#
+# Start with optional comments (from "!" to the next line end)
+# followed by ".HODE" and end with "\n.SLUTT" followed by an optional
+# separator (any number of " ", "\t", "\n" or "\r"), might have BOM at
+# the start and following ".HODE" near the start there is "..OMR=C3=85DE"
+# (either UTF-8, ISO-8859-1 or some 7 bit Norwegian charset based on
+# ASCII) , "..TRANSPAR", "..TEGNSETT " followed by the charset and a
+# separator, as well as "..SOSI-VERSJON " followed by the format
+# version and a separator.
+#
+# FIXME figure out how to accept any of [space], [tab], [newline] and
+# [carrige return] as separators, not only line end.
+
+# Not searching for full "OMR=C3=85DE" to match also for non-UTF-8
+# character sets
+0      search  ..OMR
+>0     search  ..TRANSPAR
+>>0       search  .HODE           SOSI map data
+>>>&0      search  ..SOSI-VERSJON
+>>>>&1 string  x               \b, version %s
+# FIXME could not figure out way to make a match for .SLUTT at the end required
+#>-7      string  \n.SLUTT     slutt
+#>-8      string  \n.SLUTT\n   slutt-nl
+#>-9      string  \n.SLUTT\r\n slutt-crnl2
+!:mime text/vnd.sosi
+!:ext sos
index a52f522c924d745a41e97a55d98601dc64df6154..7caf40778dfc16af7498ab190f31b165ca16bbbf 100644 (file)
@@ -1,5 +1,5 @@
 #
-# $File: Makefile.am,v 1.143 2019/05/09 16:24:36 christos Exp $
+# $File: Makefile.am,v 1.144 2019/05/20 17:25:09 christos Exp $
 #
 MAGIC_FRAGMENT_BASE = Magdir
 MAGIC_DIR = $(top_srcdir)/magic
@@ -257,6 +257,7 @@ $(MAGIC_FRAGMENT_DIR)/smalltalk \
 $(MAGIC_FRAGMENT_DIR)/smile \
 $(MAGIC_FRAGMENT_DIR)/sniffer \
 $(MAGIC_FRAGMENT_DIR)/softquad \
+$(MAGIC_FRAGMENT_DIR)/sosi \
 $(MAGIC_FRAGMENT_DIR)/spec \
 $(MAGIC_FRAGMENT_DIR)/spectrum \
 $(MAGIC_FRAGMENT_DIR)/sql \