Skip to content

Latest commit

 

History

History
36 lines (25 loc) · 4.8 KB

README.md

File metadata and controls

36 lines (25 loc) · 4.8 KB

This script generates an accurate GeoJSON for world borders based on OpenStreetMap data. The is a rewrite of simonepri's geo-maps, which generates inaccurate maps for polygons with holes in them (i.e. the South Africa polygon ends up including Lesotho). Additionally, I also included both ISO-3166-alpha-2 and alpha-3 codes (whereas geo-maps only includes alpha-3), and the maps' precision is actually based on distances.

Packages and previews

Maritime borders

NPM Package Resolution Preview URL* Package size
@osm_borders/maritime_1m 1 metre Preview 49.9 MB
@osm_borders/maritime_2m 2 metres Preview 49.8 MB
@osm_borders/maritime_5m 5 metres Preview 49.4 MB
@osm_borders/maritime_10m 10 metres Preview 48.2 MB
@osm_borders/maritime_20m 20 metres Preview 35.6 MB
@osm_borders/maritime_50m 50 metres Preview 21.2 MB
@osm_borders/maritime_100m 100 metres Preview 13.7 MB
@osm_borders/maritime_200m 200 metres Preview 8.46 MB
@osm_borders/maritime_500m 500 metres Preview 4.27 MB
@osm_borders/maritime_1000m 1 kilometre Preview 2.47 MB
@osm_borders/maritime_2000m 2 kilometres Preview 1.42 MB
@osm_borders/maritime_5000m 5 kilometres Preview 706 kB
@osm_borders/maritime_10000m 10 kilometres Preview 419 kB

* Note: For precise packages, the preview may be slow and browser-intensive to load.

Some technical details

Behind the scenes, this script queries the OpenStreetMap Nominatim API. This is actually quite important, since geo-maps' data source, polygons.openstreetmap.fr is the reason as to why polygons with holes were handled improperly.

Maps are simplified using the Douglas-Peucker simplification algorithm provided by mapshaper's simplify-map feature.

Things that could be implemented better: handling changes to OSM IDs (the osm-countries package used by this script is already outdated, and I had to patch it for this code) and including land borders, as well as doing some error handling.

Licence

The source code for this project is released under the MIT licence. Map data © OpenStreetMap contributors, released under the ODbL licence.