How/Where do I get geoJSON data for states, provinces, and administrative regions of non-US countries?

45,049

Solution 1

There is a good writeup on how to generate geoJSON from shapefiles here
http://vallandingham.me/shapefile_to_geojson.html

The steps below should take you from start to finish:

  1. Install the Quantum GIS framework http://www.qgis.org/e/qgis.
    If you are on Mac OS X, you can use this version http://www.kyngchaos.com/software
    This will give you the ogr2ogr utility used for converting shapefiles to geoJSON

  2. Download the shapefiles for your country from here http://www.gadm.org/country and unzip

  3. For Canada, and possibly other countries, the shapefile with suffix 0 is for the country boundary and the suffix 1 is for the internal regions. Not sure if this naming is consistent across countries.

  4. Upload the region level shapefile to MapShaper http://mapshaper.com/test/MapShaper.swf
    You can skip this step if you don't care to optimize the size of your resulting geoJSON

  5. Set the 'simplification level' slider in MapShaper to the desired level and export the simplified shapefile as 'Shapefile - Polygons'

  6. Download .shp and .shx file to the local directory where you unzipped the original shapefiiles, replace the original files with the simplified ones.

  7. Navigate to the local directory and run the command below, replacing <shapefile> with the actual name of the shapefile you want to convert.

    ogr2ogr -f geoJSON regions.json <shapefile>.shp

You should now have the regions for your country in geoJSON format. Check to make sure there are paths defined in regions.json and that property fields were maintained (ex. region name).

Solution 2

This process is now simplified (July 2014) compared to the steps I see in the accepted answer. It now seems much easier to get this data. I at first floundered around the web hoping I could just download a bunch of standard maps in GeoJSON format, but came up empty other than standard US/Canada offerings. As of right now there doesn't seem to be a lot available in straight GeoJSON. Instead you take an older, widely used format to generate GeoJSON. This is easy, and a good path to take. We'll be working with shape files and converting them to GeoJSON.

  1. First download a shape file for the geographic area you are interested in. A shapefile is a digital vector storage format for storing geometric location and associated attribute information. (http://en.wikipedia.org/wiki/Shapefile)

    There are lots of sources of these. These are sources I found useful:

    GADM - Download data by country or one giant file for the world. Each zip you download has multiple shape files inside starting at number 0 and increasing. The higher the number the higher the detail level. Like country, state, county, etc. (http://www.gadm.org/country)

    Another download site (http://www.naturalearthdata.com/downloads/)

    Download US State, County, Sub-County data as driven by the census bureau - http://census.ire.org/data/bulkdata.html

  2. Once you have your shape file, drag and drop it into the webpage at http://www.mapshaper.org. Here you can drag a slider to change the vector resolution. My experience was that 10% resolution looked great still for web maps, 25% was near perfect. File size was greatly reduced, so I would recommend using it. My Massachusetts map went from 800kb of GeoJSON data to 80kb after reducing resolution.

  3. Click the GeoJSON button on mapshaper and the file is automatically exported for you.

Optional - Once you have a shape file, you can edit it for free in a tool like Quantum GIS (QGIS).

You can also hand map GeoJSON data at this website. http://geojson.io/#map=2/20.0/0.0

Solution 3

Found a place to download geojson: geojson-maps.kyd.com.au that uses data from Natural Earth.

And these maps from Highcharts. This one fits the question best.

Solution 4

I've been looking for the same thing lately. There is a github account that provides the geojson for every country in the world, unfortunately, it appears to be in UTM format which D3 does not support, so if you're willing to sift through them and convert one by one to wgs84 or have or is willing to write a program that will, here is the link: https://github.com/johan/world.geo.json

Share:
45,049
beauburrier
Author by

beauburrier

Updated on August 09, 2020

Comments

  • beauburrier
    beauburrier over 3 years

    I need geoJSON formatted paths for states, provinces, and regions within multiple countries. Most readily available geoJSON data is for US states and country level boundaries, not regions within the country. This geoJSON will be used to create a geographic visualization using D3.js.