Pingu
Computer MySQL PostgreSQL Books Publications
Spielereien Kanu Business TopoDB POI Klettersteigen History TransPool Thermal Baden Brokenstuben Goldwaschen
Blog Contact
Shinguz
Google
/ch/open

GIS und Kartographie

TOC

Leaflet

Ich bin zur Zeit gerade am Rumspielen mit Leaflet: “an open-source JavaScript library for mobile-friendly interactive maps”

Beispiele

Arbeitsschritte

Latitude / Longitude (Breite/Länge, Y/X)

map.panTo([50, 30]);
map.panTo({lng: 30, lat: 50});
map.panTo({lat: 50, lng: 30});
map.panTo(L.latLng(50, 30));

Sources:

GeoJSON aus OSM exportieren

OpenStreetMap to GeoJSON and on GitHub

$ incus cp ubuntu2404-tinytemplate osmexp
$ incus start osmexp
$ incus exec osmexp bash

$ apt update
$ apt install pipx
$ pipx install osmexp
$ pipx ensurepath
$ PATH=$PATH:/root/.local/bin
$ osmexp rel 1682225 > uster.geojson

$ incus file pull osmexp/root/uster.geojson .

JSON hübsch darstellen

$ cat switzerland.geojson | jq --color-output | less -R

GeoJSON optimieren

GeoJSON minifier

Local: GeoJSON Minify

Precision 5 - 1.11 m roughly at the Equator
Precision 4 - 11.1 m roughly at the Equator
Precision 3 - 111 m roughly at the Equator
Precision 2 - 1.11 km roughly at the Equator

Tool mapshaper installieren

Im Container:

$ apt install npm
$ npm install -g mapshaper

$ mapshaper -h
$ mapshaper -h simplify
$ mapshaper switzerland_osm.geojson -info
[info]
=========================
Layer:    switzerland_osm
-------------------------
Type:     polygon
Records:  3
Bounds:   5.9559113,45.8179579,10.4922941,47.8084544
CRS:      +proj=longlat +datum=WGS84
Source:   switzerland_osm.geojson
Attribute data: [none]
$ mapshaper switzerland_osm.geojson -simplify 10% -o switzerland_osm_10pct.geojson

Zwei GeoJSON Objekte zusammenfügen (merge)

geojson-merge

$ npm install -g geojson-merge
$ geojson-merge brazil_prec3_10pct.geojson russia_prec3_10pct.geojson india_prec3_10pct.geojson china_prec3_10pct.geojson > BRIC.geojson
$ mapshaper BRIC.geojson -simplify 10% -o BRIC_10pct.geojson

Draw and Edit with GeoJson.io

Use cases

Datenquellen

Farbverläufe