geojson.xyz is a simple resource for simple geographical data, the kind that you use to create a choropleth visualization of US states or add graticules to a map. It provides data in the GeoJSON format, with levels of simplification appropriate for web maps. Most of the datasets are under 5MB in size.
For instance, if I want US state outlines, I could go to Natural Earth Data, but the GeoJSON isn’t on the website, only in the GitHub repo, and it isn’t easy to download a single large file from a repository. I could use the us-atlas project, but it doesn’t include attributes by default and requires an install with multiple dependencies and downloads. word.geo.json has usable files, but “dubious” legal status.
So geojson.xyz was born. Thanks to the diligent and brilliant work of Nathaniel V. Kelso, Natural Earth Data already has the files we need in GeoJSON, with clear licensing and clean data. All that’s needed to solve the problem is to filter out the big files
The core of the operation is file hosting: a subset of Natural Earth Data files are available over SSL, with CORS. In many cases, this means that you don’t need to download them at all: you can hotlink and load it with AJAX into your map.
using geojson.xyz to build a simple map with d3.js
In this case, I’m using Amazon CloudFront as a CDN and Amazon S3 for file hosting, and it’s sponsored by Mapbox (and used in Mapbox examples), so it can handle real usage.
geojson.xyz is a web-based list of available files, their metadata, and links to download and use them in several different ways. It includes links that automatically load a file into geojson.io using geojson.io’s URL API. For instance, here’s a map of populated places using geojson.io + geojson.xyz.
geojson-xyz is also a node module:
npm install -g geojson-xyz
It supports both fuzzy-searching, like
geojson-xyz countries, which will
automatically find the most appropriate file to download based on the query
‘countries’, as well as a choose-your-own adventure system if you know the kind
but not the precise name of the data that you want - for, if late at night,
you forget the word or spelling of bathymetry.
geojson.xyz is simple data on a server with SSL + CORS, and simple ways to get at it. Try it out for your geo projects.