Giter Site home page Giter Site logo

nkamapper / building2osm Goto Github PK

View Code? Open in Web Editor NEW
13.0 3.0 8.0 257 KB

Generates import files for OpenStreetMap with buliding footprints from Kartverket

License: Creative Commons Zero v1.0 Universal

Python 100.00%
openstreetmap kartverket cadastral building-footprints

building2osm's Introduction

building2osm

Generates import files for OpenStreetMap with buliding footprints from Kartverket.

building2osm

Generates geojson import file with building footprints.

Note: The WFS service used is currently not delivering building polygons.

Usage: python3 building2osm.py <municipality> [-split] [-original] [-verify] [-debug]

Parameters:

  • municipality - Name of the municipality to generate. Output for several municipalities is generated if county name or "Norway" is given.
  • -split - Also split output file into smaller subdivisions ("bydel", electoral or post districts).
  • -original - Produce file without any modifications.
  • -verify - Include extra tags for verification of topology modifications.
  • -debug - Include extra tags for debugging.

building_merge

Conflates the geojson import file with existing buildings in OSM and produces an OSM file for manual verification and uploading.

Usage: python3 building_merge.py <municipality> [<max distance>] [<filename.geojson>] [-debug]

Parameters:

  • municipality - Name of the municipality to conflate.
  • max distance - Optional maximum Hausdorff distance between matched buildings. Default value is 10 metres (5 metres if the building is tagged).
  • filename.geojson - Optional input file in geojson format. If not specified, the import file for the municipality will be loaded (it must be present in the default folder or in a predefined folder).
  • -debug - Include extra tags for debugging.

municipality_split

Splits the geojson import file into smaller subdivisions such as electoral districts or "bydel".

Usage: python3 municipality_split.py <municipality> [ --subdivision [ bydel | valgkrets | postnummer ]

Parameter:

  • municipality - Name of the municipality to split.
  • --subdivision bydel - Split municipality according to boroughs.
  • --subdivision postnummer - Split municipality according to post districts.
  • --subdivision valgkrets - Split municipality according to electoral districts (fewer than post districts in large towns; default).
  • --area - Save district boundaries only (no split). Default is to save boundary file when splitting.

filter_buildings

Filters the geojson import file, removing buildings that have already been imported.

Usage: python3 filter_buildings.py --municipality <id> --input <geojson> --output <geojson>

Parameters:

  • --municipality id - Municipality code to use for downloading
  • --input geojson - Path to the input geojson file
  • --output geojson - Path to the output geojson file

Notes

  • Source data is from the Cadastral registry of Kartverket
    • "INSPIRE Buildings Core2d" - Contains polygons of the building footprints.
    • "Matrikkelen Building point" - Contains information about the building type/usage.
    • "Matrikkelen Address apartment level" - Contains information about levels of the building.
  • The building=* tag is given a value corresponding to the building_type translation table in this respository. Please provide feedback if you observe that the tagging should be modified.
  • Certain modifications of the footprint polygons are made to avoid clutter in OSM:
    • Polygons which are almost square are rectified (orthogonalized) to get exact 90 degrees corners. Groups of connected buildings are rectified as a group. Multipolygons are supported. A polygon is not rectified if it would relocate one of its nodes by more than 20 centimeters.
    • Redundant nodes are removed if they are located on an (almost) straight line.
    • Curved walls are only simplified lightly.
  • Output is stored in a geosjon file which may be loaded into JOSM when the OpenData plugin has been installed. Please read the import plan for guiding on how to do the import.
  • The building_merge.py program conflates the import buildings with existing buildings in OSM.
    • New buildings are loaded from the geojson import file. You may split the import file into smaller parts using municipality_split.py or manually.
    • Existing buildings are loaded from OSM.
    • New and existing buildings which are each other's best match within the given maximum Hausdorff distance (default 10 metres) are automatically conflated. They also need to have similar size (default up to 50% difference).
    • The OSM_BUILDING tag will show which building tag was used by the existing building, unless they are in similar residential/commercial/farm categories.
    • Use the To-do plugin in JOSM to:
      1. Resolve Overlapping buildings.
      2. Resolve Building within buildings.
      3. Check OSM_BUILDING for manual retagging of building types.
      4. Check untouched existing OSM buildings.
      5. Check if entrances or other tagged nodes needs to be reconnected to the new buildings (search for type:node ways:0 -untagged).
    • Use the boundary polygons from municipality_split.py and the JOSM functions Selection->All inside and Edit->Purge to work on a subset of a large municipality.
    • The building_merge.py program may be run several times for the same municipality. Only buildings with new ref:bygningsnr will be added each time.

References

building2osm's People

Contributors

bmispelon avatar nkamapper avatar noenandre avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

building2osm's Issues

Polygonproblemer

Split feiler for Utsira (melding om at polygon ikke henger sammen), selv om koordinat for første og siste node ser like ut.

Polygon med inner ser heller ikke ut til å fungere, f.eks. valgkretser i Ås og i Nordkapp. Om indre polygon ikke støttes så ville det være greit om ytre polygon likevel støttes.

Tar du en titt på dette, @noenandre ?

WMS endpoint for kretsene: http://openwms.statkart.no/skwms1/wms.matrikkel.seeiendom2

Bygningstagging

Ser det står "not used". Mener du at de ekstra taggene du antyder ikke skal bli med i importen? Da bør de kanskje rett og slett ikke nevnes i det heletatt? Samtidig ser jeg behov for ekstra tagger.

Noen kommentarer til konkrete bygningstyper:j

141 kan godt få building_levels=2
142 kan godt få "building_levels=3 or 4" etc.

193 "brakker" er ikke helt det samme som "barracks" på engelsk. "Barracks" har mer permanent karakter. "Demountable" buildings er mer som norske "brakker".

Ikke alle 673 er kristne. Disse knapt et "place_of_worship" heller. Og "worship_of_god" er vel ikke en tagg i det heletatt?
674 er ikke bare muslimske moskeer, noen er også synagoger. Tror ikke det blir populært å blande dem. Ekstra-taggene bør slettes eller byttes med noe a-la "fixme=mosque or synagogue?"

840 kan også få amenity=toilets
970 kan også få emergency=yes

Feil i polygon_centroid

Om noen orker ta en titt:

Funksjonen polygon_centroid() i building_merge.py gir en del ganger rare resultater, med midtpunkt godt utenfor polygonet, selv for enkle kvadrater.
Hva kan være feil her?

Kunne ha brukt et ferdig bibliotek selvfølgelig, men målet her var å ha en lav terskel for å kjøre skriptet.

Eksklave mangler bygninger

Municipality_split.py får ikke med bygningene i Tønsbergs eksklave ved Undrumsdal (testet med valgkrets-split). Valgkretsen Undrumsdal har her to polygoner. Gjelder også valgkrets nr 10 "Tønsberg", som består av to polygoner.

Splitte import i bydelsfiler

Siden importfilene vil bli oppdatert fremover ville det være praktisk å ha et lite skript som lager bydelsfiler for de fire store byene.

  • Bydelsgrensene kan hentes fra OSM.
  • Geojson format.
  • Gjenbruke f.eks. inside_polygon fra building2osm.
  • Filnavn f.eks. med endelse _bydel_<navn>.geojson.
  • Helst ikke eksterne avhengigheter.

@noenandre - Noe for deg?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.