Lets draw borders of England using D3, and outline NY meanwhile....
A lot of articles starts from these words. And next always follows
The first task for any map is finding geometry.
And most of normal people could not accomplish this quest. So, then..
The source for shapes for all the countries and states.
OSME-geometry contain:
- world
- world/MicroRegionName (Arfica -> CentralAmerica -> ....)
- country as iso3166-1 code (US, GB, DE)
- state(region) as iso3166-2 code (AU-NSW, RU-MOW...)
! 500M ! This repo has size over half gigabyte! But you always use a small and single shape file
First step is to get data from osme-geometry
You can use unpkg to get access to the datafile.
normal quality data
<script src="https://unpkg.com/osme-geometry/umd/AU.js"></script>
highter quality data
<script src="https://unpkg.com/osme-geometry/umd/AU.hd.js"></script>
low quality data
<script src="https://unpkg.com/osme-geometry/umd/AU.sd.js"></script>
data without maritime borders (ie with coastline)
<script src="https://unpkg.com/osme-geometry/umd/AU.coast.js"></script>
data will be stored in
window.osmeGeometry['AU']
import AUGeometry from 'osme-geometry/AU/geom.js';
// for nodejs you can also specify language
import AUGeometry from 'osme-geometry/AU/de.geom.js';
import AUGeometry from 'osme-geometry/AU/en.coast.hd.js';
Data is stored in OSME format, similar, but incompatible to TopoJson. To use data, you first need to convert it into GeoJSON
osme.geoJson(AUGeometry).then(geoJson => doSomething);
You can found different way to display a data in osme repository.
It is also possible to use osme
without osme-geometry
, in that case data will be fetched from backend provided by esosedi(http), or geolocated(https)
osme.geoJson('AU').then(geoJson => doSomething);
OSME data file is 5-10% bigger than TopoJSON equivalent. It just contain extra information.
http://data.esosedi.org/ - project home page. https://codesandbox.io/s/koryn1z5no - codesandbox
- The data included in this document is from www.openstreetmap.org.
- The data included in this document is from wikipedia.org.
- The data included in this document is from geonames.org.
- The data included in this document is from esosedi.org.
- The data is made available under ODbL and CC-BY-SA
MIT