1

I need shapes of admin regions as GeoJSON (Multi)Polygons. After looking for an appropriate source for way too long, I found this NE Admin 1 dataset.

Using ogr2ogr to convert the data to GeoJSON, I found features with geometry-type (Multi)LineString. Not quite what I wanted. This guy on GitHub used a different dataset from Natural Earth, but he got (Multi)Polygons. Are there some special options for ogr2ogr, some possible conversions, or is it the dataset?

I need to determine whether a point is in a province/region and with the tools I'm using, that's easiest with polygons. If it happens to be a problem with the dataset, does anyone know an alternative?

That's the command I used for conversion:

ogr2ogr -f GeoJSON -t_srs crs:84 output.geojson ne_10m_admin_1_states_provinces_lines.shp`

PS: Most examples I've found specify -t_srs crs:84. I do need WGS84, as I'm also using data from geonames.org. But I'm not sure if I even need the transformation.

3

The clue is in the name :-) You downloaded boundary lines when infact you wanted to use States and Provinces which is a polygon layer.

  • Begginer mistake, we all went through this (secretly) – Hugolpz Feb 6 '15 at 11:47
  • Awww, man I'm embarrassed ^^ I thought 'lines' means just the outlines, the shapes and the other one contains more data x) ty! – Benjamin Maurer Feb 6 '15 at 11:59
3

Regarding your Post Scriptum: You already use the right projection. CRS:84 is synonymous to the EPSG-Code: 4326, which is the Coordinate-Reference-System known as: WSG84.

You can always use EPSG-Codes instead of CRS-Names. EPSG-Codes are not so ambiguous in my opinion.

In your Example, the transform-srs-parameter (-t_srs) would look like this: -t_srs EPSG:4326

Oh, and by the way: you dont need to retransform, when your dataset already has the right projection. So using the set-SRS parameter (-s_srs) would be appropriate in your example.

  • As far as I see, Natural Earth shapefiles are already in WGS84, so no need to transform. – AndreJ Feb 6 '15 at 10:15
  • @AndreJ: You are right. Just edited my answer. – Mathias Vonende Feb 6 '15 at 10:22
  • You don't even need the -s_srs, because that is in the .prj file. And -s_srs without -t_srs would do nothing (no target defined, hence no reprojection). – AndreJ Feb 6 '15 at 11:02

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.