I am following Mike Bostock's D3 Lets make a map to create GeoJSON for states and provinces of a country. I got a shapefile for states and provinces from Natural Earth. I am trying to extract info for India with this command:

ogr2ogr -f GeoJSON -where "ADM1_A3 IN ('IND')" subunits.json ne_10m_admin_1_states_provinces.shp

Here is the error:

GeoJSON driver failed to create subunits.json

Is there any ISO country code for Admin-1 level?

  • 1
    What precisely are you seeing when it's not working? – PolyGeo Jul 30 '16 at 20:33
  • "not working" isn't a description of the problem - if it worked, you wouldn't be here! Instead, say what you expected to happen, and what happened instead. We can't see the screen, you have to describe it to us exactly. – BradHards Jul 31 '16 at 2:28
  • sorry i updated the question :( – srinivas Jul 31 '16 at 3:59

I can use the same command for states and provinces too with AMD0 as:

ogr2ogr -f GeoJSON -where "ADM0_A3 IN ('IND')" subunits.json ne_10m_admin_1_states_provinces.shp

and one more working solution is:

ogr2ogr -f GeoJSON -where "gu_a3 = 'USA'" subunits.json ne_10m_admin_1_states_provinces.shp

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.