OpenStreetMap

ChristianA has commented on the following diary entries

Post When Comment
This, That & The Other 11 days ago

If one is standing on This Street it is probably very efficient to give directions to someone going to That Street. The other way round we probably be rather confusing (and hilarious)!

Öppna Data: Import av Lantmäteriets Terrängkartan och Trafikverkets NVDB 2 months ago

MEN: endast större gruvor mm är med. Se även mina kommentarer om att datat kan ligga "lite snett".

Öppna Data: Import av Lantmäteriets Terrängkartan och Trafikverkets NVDB 2 months ago
#!/bin/bash

reg="05"
#Hela OG:
xmin=470000
xmax=630000
ymin=6395000
ymax=6545000

in_atr_name="KATEGORI"

# Lista på lager att bearbeta, dvs splitta upp
declare -A layers
# polygonlager
layers["ma"]="Åker;Fruktodling;"
layers["mb"]="Fritidsbebyggelse;Hög bebyggelse;Industriområde;Låg bebyggelse;Sluten bebyggelse"
layers["mo"]="Annan öppen mark;Skog, barr- och blandskog;Lövskog;Annan öppen mark utan skogskontur;"
layers["ms"]="Berg i dagen;Sankmark, normal;Sankmark, svårframkomlig;Sankmark, torvtäkt"
layers["mv"]="Vattenyta med diffus strandlinje;Vattenyta"

# linjelager
layers["fl"]="Fornlämningsavgränsning;Gruvhål, större"
layers["hl"]="Vattendrag under mark;Vattendrag, kartografisk klass 1;Vattendrag, kartografisk klass 2;Vattendrag, kartografisk klass 3;Vattentub och vattenränna"
layers["kl"]="Kraftledning, region;Kraftledning, stam;Transformatorstationsområde"
#layers["vl"]="Allmän väg klass 1;Allmän väg klass 1, i underfart;Allmän väg klass 2;Allmän väg klass 2, i underfart;Allmän väg klass 3;Allmän väg klass 3, i underfart;Bilväg;Bilväg, i underfart;Bättre bilväg;Bättre bilväg, i underfart;Färjeled;Gata;Gata i sluten bebyggelse;Gata, i underfart;Gata, större;Gata, större, i underfart;Genomfartsgata, -led, i underfart;Genomfartsgata,-led;Motorväg;Motorväg i underfart;På- och avfartsväg klass 1;På- och avfartsväg klass 1, i underfart;På- och avfartsväg klass 2;På- och avfartsväg klass 2, i underfart;På- och avfartsväg klass 3;På- och avfartsväg klass 3, i underfart;Sämre bilväg;Sämre bilväg, i underfart;Uppfartsväg;Uppfartsväg, i underfart"
layers["vo"]="Cykelväg, parkväg;Elljusspår;Gångbro och spång;Gångstig;Linbana;Traktorväg;Underfart för övrig väg eller led;Vandringsled;Vandringsled, längs väg"


# beskrivning av OSM taggar för varje LM kategori ovan
declare -A mapper
mapper["Fruktodling"]="landuse=orchard"
mapper["Åker"]="landuse=farmland"
mapper["Fritidsbebyggelse"]="landuse=residential"
mapper["Hög bebyggelse"]="landuse=residential"
mapper["Industriområde"]="landuse=industrial"
mapper["Låg bebyggelse"]="landuse=residential"
mapper["Sluten bebyggelse"]="landuse=residential"
mapper["Annan öppen mark"]="landuse=meadow"
mapper["Annan öppen mark utan skogskontur"]="meadow"
mapper["Lövskog"]="landuse=forest;leaf_type=broadleaved"
mapper["Skog, barr- och blandskog"]="landuse=forest"
mapper["Berg i dagen"]="natural=bare_rock"
mapper["Sankmark, normal"]="natural=wetland"
mapper["Sankmark, svårframkomlig"]="natural=wetland"
mapper["Sankmark, torvtäkt"]="natural=wetland"
mapper["Vattenyta"]="natural=water"
mapper["Vattenyta med diffus strandlinje"]="natural=wetland"
mapper["Fornlämningsavgränsning"]="historic=yes"
mapper["Gruvhål, större"]="landuse=quarry"
mapper["Vattendrag under mark"]="waterway=stream;tunnel=culvert"
mapper["Vattendrag, kartografisk klass 1"]="waterway=stream"
mapper["Vattendrag, kartografisk klass 2"]="waterway=stream"
mapper["Vattendrag, kartografisk klass 3"]="waterway=river"
mapper["Vattentub och vattenränna"]="waterway=drain"
mapper["Kraftledning, region"]="power=line"
mapper["Kraftledning, stam"]="power=line"
mapper["Transformatorstationsområde"]="power=substation"
mapper["Allmän väg klass 1"]="highway=primary"
mapper["Allmän väg klass 1, i underfart"]="higgway=primary;tunnel=yes"
mapper["Allmän väg klass 2"]="highway=secondary"
mapper["Allmän väg klass 2, i underfart"]="highway=secondary;tunnel=yes"
mapper["Allmän väg klass 3"]="highway=tertiary"
mapper["Allmän väg klass 3, i underfart"]="highway=tertiary;tunnel=yes"
mapper["Bilväg"]="highway=unclassified"
mapper["Bilväg, i underfart"]="highway=unclassified;tunnel=yes"
mapper["Bättre bilväg"]="highway=unclassified"
mapper["Bättre bilväg, i underfart"]="highway=unclassified;tunnel=yes"
mapper["Färjeled"]="waterway=ferry"
mapper["Gata"]="highway=residental"
mapper["Gata i sluten bebyggelse"]="highway=residential"
mapper["Gata, i underfart"]="highway=residential;tunnel=yes"
mapper["Gata, större"]="highway=tertiary;tertiary=major_street"
mapper["Gata, större, i underfart"]="highway=tertiary;tertiary=major_street;tunnel=yes"
mapper["Genomfartsgata,-led"]="highway=tertiary;tertiary=through_street"
mapper["Genomfartsgata, -led, i underfart"]="highway=tertiary;tertiary=through_street;tunnel=yes"
mapper["Motorväg"]="higwhway=motorway"
mapper["Motorväg i underfart"]="highway=motorway;tunnel=yes"
mapper["På- och avfartsväg klass 1"]="highway=primary_link"
mapper["På- och avfartsväg klass 1, i underfart"]="highway=primary_link;tunnel=yes"
mapper["På- och avfartsväg klass 2"]="highway=secondary_link"
mapper["På- och avfartsväg klass 2, i underfart"]="highway=secondary_link;tunnel=yes"
mapper["På- och avfartsväg klass 3"]="highway=tertiary_link"
mapper["På- och avfartsväg klass 3, i underfart"]="highway=tertiary_link;tunnel=yes"
mapper["Sämre bilväg"]="highway=track"
mapper["Sämre bilväg, i underfart"]="highway=track;tunnel=yes"
mapper["Uppfartsväg"]="highway=service"
mapper["Uppfartsväg, i underfart"]="highway=service;tunnel=yes"

mapper["Cykelväg, parkväg"]="highway=cycleway"
mapper["Elljusspår"]="highway=path,lit=yes,piste=cross_country"
mapper["Gångbro och spång"]="highway=path,bridge=yes"
mapper["Gångstig"]="highway=path"
mapper["Linbana"]="aerialway=gondola"
mapper["Traktorväg"]="highway=track;tracktype=grade5"
mapper["Underfart för övrig väg eller led"]="highway=path;tunnel=yes"
mapper["Vandringsled"]="highway=path;marked_trail=yes"
mapper["Vandringsled, längs väg"]="highway=path;marked_trail=yes"

for layer in "${!layers[@]}"; do

    echo $layer
    #echo "\'${layers[$layer]}\'"
    IFS=';' read -r -a array <<< "${layers[$layer]}"
    for thingy in "${array[@]} "; do
        # remove trailing space in last item of array (why?)
        thingy=$(echo $thingy | sed 's/[ \t]*$//')
        laynam=$(echo $thingy | sed 's/ /_/g' | sed 's/-//g' | sed 's/,//g')""
        fnam="${laynam}.shp"
        # split shapefile into each component
        ogr2ogr -spat $xmin $ymin $xmax $ymax -update -append -where "KATEGORI=$(echo \'${thingy}\')" $fnam ../${layer}_${reg}.shp

        # add all fieldnames/values to each file
        IFS=';' read -r -a attrs <<< "${mapper[$thingy]}"
        echo $attrs
        for attr in "${attrs[@]}"; do
            attrnam=$(echo $attr | awk -F'=' '{print $1}')
            attrval=$(echo $attr | awk -F'=' '{print $2}')
            echo "ATTRNAM: $attrnam, ATTRVAL: $attrval"
            # add OSM fields/attrs
            ogrinfo $fnam -sql "ALTER TABLE $laynam ADD COLUMN ${attrnam} character(40)"
            ogrinfo $fnam -sql "UPDATE $laynam SET ${attrnam}='${attrval}'" $laynam -dialect sqlite

        done
        # remove LM fields/attrs
        ogrinfo $fnam -sql "ALTER TABLE $laynam DROP COLUMN KATEGORI"
        ogrinfo $fnam -sql "ALTER TABLE $laynam DROP COLUMN KKOD"
        # add attribution
        ogrinfo $fnam -sql "ALTER TABLE $laynam ADD COLUMN source character(20)"
        ogrinfo $fnam -sql "UPDATE $laynam SET source='Lantmäteriet'" $laynam -dialect sqlite
   done

done

# mosa ihop alla hl lager
IFS=';' read -r -a array <<< "${layers["hl"]}"
for thingy in "${array[@]} "; do
    echo $thingy
    thingy=$(echo $thingy | sed 's/[ \t]*$//')
    laynam=$(echo $thingy | sed 's/ /_/g' | sed 's/-//g' | sed 's/,//g')""
    fnam="${laynam}.shp"
    ogr2ogr -update -append -addfields vattendrag.shp $fnam
done

# mosa ihop alla våtmark lager
declare -A dummy
dummy["ms"]="Sankmark, normal;Sankmark, svårframkomlig;Sankmark, torvtäkt"

IFS=';' read -r -a array <<< "${dummy["ms"]}"
for thingy in "${array[@]} "; do
    echo $thingy
    thingy=$(echo $thingy | sed 's/[ \t]*$//')
    laynam=$(echo $thingy | sed 's/ /_/g' | sed 's/-//g' | sed 's/,//g')""
    fnam="${laynam}.shp"
    ogr2ogr -update -append -addfields våtmark.shp $fnam
done
Reflections on 10 years of a changing Open Source Map 4 months ago

Nice read and very nice work! Cheers!

A trip to Dwasieden castle ruins 5 months ago

Well, first and foremost Germany is a SI-unit country. When I adjusted the image to fit my GPS trace it also seemed to be in meters. If you then look at the original blueprint (can be found at https://de.wikipedia.org/wiki/Schloss_Dwasieden ) it says "M".

Mapping the Student City 5 months ago

Nice work! Mapping buildings take a lot of time, but the resulting map is much better then before.

The joy and sadness of open data 5 months ago

I do not agree that I am demonizing armchair mapping. I agree however that armchair mapping is a large and important part of mapping the world for OSM. I also enjoy armchair mapping, when it is involves tracing from satellite data (and from older maps), but in not too large portions. What I like less is the work I described above; trying to merge vector data from different datasets with OSM.

For me the whole OSM thing has been about discovering the area where I live, or where I go on vacation and so on. And also about discovering things I can't from other maps or sources. For me it is wenting my head from everyday crap as you call it.

Actually visiting a place almost always gives you more information than looking at it from a distance. Sure it takes more time, but for me it is worth it. However, calling on the ground mapping for a pipe dream and limited sounds a bit elitist to me.

Cheers!

More mapping of old quarries 6 months ago

Thanks for the nice comments!

Old quarry-mapping in the summer rain 9 months ago

Ok, thanks. Any interesting quarry-mapping experiences you'd like to share?

Old quarry-mapping in the summer rain 9 months ago

Hi. Yes, you're probably right. I should improve the tagging. I remember though that I found the suggestions in the wiki not matching my case.

Do you have any example of your mapping adventures?

Old quarry-mapping in the summer rain 9 months ago

What do you mean, "in the end"? I have mapped the outline of the holes for each little quarry. I do this be walking along the perimeter once. Sometimes it is hard since there may be trees in the way, or it may be a bit dangerous since you may fall into the hole. In the latter case I walk a little further away...

Stuff found in the forest during a short walk 11 months ago

Thanks for the comments.

Ruins of another sawmill 11 months ago

Hi, yeah I guess I should do that as well. I haven't been using Mapillary for a long time, but I know I should...

Two trips to ruins of an old sawmill 12 months ago

No worries, it usually happens when I am mountiainbiking.

Using DEM and slope data to find interesting mapping locations about 1 year ago

The SRTM data? It was a couple of years ago that I checked, but according to https://wiki.openstreetmap.org/wiki/SRTM , it is in the public domain.