Boundaries Map 4.2 - English version

The Boundaries Map provides a comfortable overview of the administrative boundaries in the OSM dataset. It also provides download capabilities for boundaries.

  • Overview of the administrative boundary tree for quality control purposes
  • Export of boundaries in various formats
 
The newest version is 4.2, from July 2017. Features that are new in 4.2 (compared to 4.1) are marked in red.

Overview:

bm overview1

 
There are 5 sections, with the following functionality:
  • Header
    Version of the application, timestamp of the data used, search bar, sidebar (on the right) and OAuth functionality.
  • Footer
    Options for export-format, buffer, union, export layout, export areas, API switch and the export button.
  • Left panel
    The treeview of the hierarchy of the administrative boundaries
  • Right panel
    The right sidebar can be toggled. It contains some short information, a link to a TODO page (in german), two donation buttons and the imprint.
  • Center
    The map :-). You can switch the basemap with the "+" in the top right corner; black/white looks best. Also a PayPal donation and flattr button - keeping the server running 24/7/365 consumes quite some energy. Please consider a donation/flattr.

Usage:

The boundaries map was built as a tool for quality control to visualize the nesting of administrative boundaries. The boundaries to display are selected on the left side. This way you can spot inconsistencies quite easy.
  

bm overview1
Here Hamburg
was not yet entirely accurate. The district Hamburg-Mitte was not mapped correctly. Of course, it's corrected now.

Context menu:

bm contect menu

In Context menu (place cursor on the desired name, then right-click) you can trigger certain actions:
  • Select children (S):

    Selects all borders the next level.

  • Deselect children (D):

    Deselects all borders the next level.

  • Deselect all children (A):

    Deselects all children of all sublevels.

  • Select next admin level (N):

    Selects all children of the next deeper admin level. This is sometimes useful if there are on one level different admin levels which unfortunately happens from time to time.

  • Export full subtree (json & shp only) (X):

    This function is currently a simple export of an entire country or a part of the country - in a server-friendly way.  Here the export is still started directly without further options.

  • Edit (JOSM & Merkaartor only) (E):

    It is using the remote edit functionality of these two editors. The relation of the border appears in the editor.

Searching:

In the search field borders can be searched for. Small and large letters are not relevant. The percent sign "%" is used as a wildcard. This is standard with PostgreSQL.

 

You can search borders by relation and by country too. For relations enter the OSM ID numerically, for countries three digit ISO-code in upper case. (For example, DEU for Germany or ALB for Albania)

 

Note: A search using a search pattern that starts with "%", is compared to the other search slowest since the search index can not be used.

The first 20 hits are displayed. However, there is pending a solution to the case that the result does not appear in it, because it is not in the first 20 hits. Here you have to make the search for time stop detail.
 

bm contect menu

In the search field you can enter an OSM ID of the Border directly. A search with wildcard seems not useful here. Or? We will see.

bm contect menu

Export:

The important export parameters are configured in the footer.

bm footer menu

Since the export function with version 4.1 of the Boundaries Map was totally redesigned, I want to be brief here.

  • Select the desired export format.
    • shp - shapefile format
    • json - GeoJSON format
    • svg - SVG graphics
    • poly - OSM Polygon File
    • bpoly - OSM polygon file with an enlarged margin (buffer). This is sometimes advantageous during clipping.
      If bpoly is selected, the size of the buffer can be entered in kilometres.
    • Is Union activated, all borders will be merged to a single polygon with the perimeter (PostGIS: ST_Union ()) of all borders.

  • Select the desired export layout to match the planned processing.
    • single - all polygons in a single block
    • split - each polygon a separate data file
    • levels - all polygons of one admin level summarized in one data file

  • Select the desired export area.
    • water - The borders including oceanic areas (the 12-mile zone iir.) will be exported.
    • land - The borders will be clipped to the coastlines and the larger lakes.
  • Activation or deactivation of the API functionality.
    • off: Export will be done as before.
    • on: A popup will display the command-line, which is necessary to do the export without using the GUI.

Miscellaneous:

Currently authentication via OAuth is mandatory. This is due to the fact that many external "customers" don't use Boundaries Map for QA - this is what it was intended for - but as a source for downloading boundaries. Unfortunately they also download hundreds of boundaries simultaneously, which kept crashing my server. The mandatory authentication relaxed the situation a bit, as I now can see who is the culprit and can contact them directly via OSM mail, e.g. making them aware of the "Export full tree" feature or the new API functionality.

 

For similar reasons, I limited the number of simultaneously selectable boundaries. The current limit is 50, but this needs further fine tuning.

 

If you use clipped land boundaries, you will experience a considerably lower performance. These are much more complex than the sea boundaries, as they include the ragged coastline.

 

API:

Starting here i'll describe the new API. Because the whole chapter is new, red markings are not used.

 

The API is ultimately an extended URL which is used together with a command-line program of choice (I recommend curl).

 

The goal it to separate the export of borders from Boundaries Map GUI. The GUI has significant weaknesses that result in many problems when invoking larger exports. This has sometimes even led to server crashes. In addition, the manual selection by dozens of borders is really tiresome.

 

    • selected
      Specify the starting relation

 

    • to_AL [default: to_AL=4]
      Specify the highest admin level to be exported.

 

    • from_AL [default: from_AL=2]
      Specify the highest admin level to be exported.

 

    • union [default: union=false]

       

      • true -The exported polygon will be created using the union (PostGIS ST_Union()) of all boundaries. The result will be one polygon describing the outline of all selected boundaries.
      • false - The boundaries will not be combined.

 

    • exportAreas [default: exportAreas=water]

       

      • water - The borders including the maritime water areas will be exported.
      • land - The borders will be clipped using the coastline.

 

    • exportLayout [default: exportLayout=levels]

       

      • single - export all borders in one single block.
      • split - each border goes to one separated data file.
      • levels - all borders within one admin level will go to one seperate data file.

 

    • exportFormat [default: exportFormat=shp]

       

      • shp - Shapefile format
      • json - GeoJSON-format
      • svg - SVG grafic

 

    • apiKey
      That is an user specifiy key using this format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

 

    • apiVersion [default: api=1.0]
      Specifies which api version to use. Just now this is version 1.0.

 

Examples:

 

  • The following image shows the output and further processing under Linux:

     

    #curl -f -o germany.zip --url 'https://wambachers-osm.website/boundaries/exportBoundaries?apiversion=1.0&apikey=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&selected=51477'
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  114M  100  114M    0     0   590k      0  0:03:18  0:03:18 --:--:-- 3951k
    #ls
    germany.zip GER.zip get.sh World_AL2.GeoJson World_AL4.GeoJson
    #unzip germany.zip
    Archive: germany.zip
    (C) OpenStreetMap contributors
    inflating: Germany_AL2.dbf 
    inflating: Germany_AL2.prj 
    inflating: Germany_AL2.shp 
    inflating: Germany_AL2.shx 
    inflating: Germany_AL4.dbf 
    inflating: Germany_AL4.prj 
    inflating: Germany_AL4.shp 
    inflating: Germany_AL4.shx 
    inflating: Germany_AL5.dbf 
    inflating: Germany_AL5.prj 
    inflating: Germany_AL5.shp 
    inflating: Germany_AL5.shx 
    inflating: Germany_AL6.dbf 
    inflating: Germany_AL6.prj 
    inflating: Germany_AL6.shp 
    inflating: Germany_AL6.shx 
    inflating: Germany_AL7.dbf 
    inflating: Germany_AL7.prj 
    inflating: Germany_AL7.shp 
    inflating: Germany_AL7.shx 
    inflating: Germany_AL8.dbf 
    inflating: Germany_AL8.prj 
    inflating: Germany_AL8.shp 
    inflating: Germany_AL8.shx
    
    The time needed for the creation of a new export can reach several minutes up to a maximum of 10 minutes. After 10 minutes the job is aborted. If there are frequent abortions, please notifiy me.
     
    The result is a ZIP file with all administrative boundaries of Germany, one separate shape per admin level.
  • Internal cache and impacts:
     
    All exports and graphics generated between update cycles are temporarily stored in a server cache. That means the results are stored on the server and answered in some cases directly from the cache. This results to significantly faster answers for frequently occurring queries. This may be seconds instead of minutes :).
     
    All subsequent queries with absolutely the same parameters (exportFormat, exportLayout, exportAreas, from_AL, to_AL and selected) are answered from the cache.
     
    Cache is reset each nightby the analysis of the raw data. This usually takes place in the middle of the night, but sometimes a little bit later, depending on how long the evaluation of the raw data runs.

    I will query for the most "popular" exports and will create new ones in the early morning, so that the otherwise empty cache is already filled with something.

  • Finances:
        
    The server is operated privately @home by me and as such caused considerable power and communication costs. Currently, this is a 16-core computer with Intel Xeon, 64GB memory, 2 TB HDD and 2x960 GB SSD.
  •  
    I do not want to have to go as far as charging for downloads of commercial users or even completely discontinue the service.