[Kjell Cato Heskjestad] > En SOSI-fil kan ha et vilkårlig antall kommentarlinjer før .HODE. En > kommentar innledes av tegnet !, og avsluttes av linjeskift.
Tusen takk for tilbakemeldingen. Jeg har brukt den til å forbedre magic-regelen litt, og sendt inn en patch til <URL:https://mailman.astron.com/pipermail/file/2019-May/thread.html>, så får vi se om den blir akseptert. Klarte ikke lage en vanntett magic-regel, men kjenner igjen de SOSI-filene jeg har testet på så langt. Her er mitt forslag til regel: diff --git a/magic/Magdir/sosi b/magic/Magdir/sosi new file mode 100644 index 00000000..afbd7d6c --- /dev/null +++ b/magic/Magdir/sosi @@ -0,0 +1,36 @@ +#------------------------------------------------------------------------------ +# $File: $ +# SOSI +# Summary: Systematic Organization of Spatial Information +# Long description: Norwegian text based map format +# File extension: .sos +# Full name: Petter Reinholdtsen ([email protected]) +# 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ÅDE", +# "..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. + +0 search ..OMRÅDE +>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 application/vnd.sosi +!:ext sos -- Vennlig hilsen Petter Reinholdtsen _______________________________________________ kart mailing list [email protected] https://lists.nuug.no/mailman/listinfo/kart
