Cut polygons from map units data (10m)
Home › Forums › Natural Earth Map Data › Cultural Vectors › Cut polygons from map units data (10m)
- This topic has 5 replies, 1 voice, and was last updated 11 years, 11 months ago by WrinkledCheese.
-
AuthorPosts
-
January 8, 2013 at 7:19 pm #3843
WrinkledCheeseParticipantHello everyone,
I’ve been trying to find a way so that I can merge two data sets into one and I’m not having much luck, and it may be due to my inexperience in the tools I’m using, but what I’m trying to do is generate a basic set of land polygons which include major lakes and rivers. I’m not too picky as to what’s included so long as the data is manageable.
What I’ve been trying to do is either have two layers of polygons, or a single layer, I honestly don’t care, so long as all the data is available.
My first atempt involved the following:
ogr2ogr test.shp ne_10m_admin_0_map_units.shp
ogr2ogr test.shp -update -append -skipfailures ne_10m_lakes.shp
This seems to work, albeit at a seemingly diminished capacity.
So I looked at the usage for ogr2ogr and I came across -slipsrc. I was hoping it would clip the polygon data of the provided datasource from the polygons in the input file. But this didn’t work at all:
ogr2ogr test.shp -skipfailures -clipsrc ne_10m_lakes.shp ne_10m_admin_0_map_units.shp
I expanded on the idea of clipping the lakes from the land polygons and now I’m just spinning my wheels. One thing I’m sure of is that I need to recompile GDAL with GEOS support.
My latest command is this:
ogr2ogr test.shp -skipfailures -clipsrc ne_10m_lakes.shp -clipdst ne_10m_admin_0_map_units.shp ne_10m_admin_0_map_units.shp
While I recompile GEOS, GDAL and all require dependencies, can someone tell me if I’m on the right track? I hope someone replies by the time I have it reinstalled with the correct libraries.
The reason I would like the land and lakes data on one layer is because I’m trying to convert the resulting shp file into a JavaScript file for use with jVectorMap (jvectormap.com) and I’m not too sure how well the converter python script will handle multiples layers as it only expects one datasource file.
January 8, 2013 at 7:29 pm #4459
NathanielKeymaster@WrinkledCheese: clip would result in only the lake portions of the admin_0 being shown. Erase is more what you need, but not supported in OGR out of the box.
However, this is available straight off the site: https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/ne_10m_admin_0_countries_lakes.zip
From:
https://www.naturalearthdata.com/downloads/10m-cultural-vectors/10m-admin-0-countries/
While GeoJSON allows heterogeneous data inside of one container file, SHP requires the data models of the components to match or odd things will result.
If you only want land polygons, there is:
https://www.naturalearthdata.com/downloads/10m-physical-vectors/
January 8, 2013 at 7:37 pm #4460
WrinkledCheeseParticipantThanks Nathaniel,
The reason I was working with ne_10m_admin_0_map_units is because I’ve been told the IRA might come get me if I bulk Northern Ireland in with the English/UK.
ne_10m_admin_0_map_units is exactly what I need with the exception of certain lakes missing – IE Great Lakes separating Ontario From Michigan.
Maybe my preferred solution would be to clip the ne_10m_admin_0_countries from the ne_10m_admin_0_map_units.
January 8, 2013 at 10:57 pm #4461
NathanielKeymasterWhy can’t you overlay the lakes so it looks like it’s cutting out the admin graphically?
January 9, 2013 at 2:22 pm #4462
WrinkledCheeseParticipantI take the data and then use a python script to convert it into JavaScript. The script is available as part of the jVectorMap project package (converter/converter.py), if you want to read it.
The converter script takes a few arguments.
Datasource: It only takes one input file.
Data Layer: It only uses the first layer of the datasource input file using ogr library.
def loadData(self):
source = ogr.Open( self.inputFile )
layer = source.GetLayer(0)
http://jvectormap.com/ – jvectormap [dot] com
It’s a jQuery plugin.
January 9, 2013 at 3:06 pm #4463
WrinkledCheeseParticipantOne of the developers for jVectorMap tells me that in the development branch( I think ) they have added the ability to load multiple GIS datasources into one map. Just going through the code now to find out since the documentation available is for the release 3 months ago and he says they only committed the source to git a few weeks ago.
-
AuthorPosts
You must be logged in to reply to this topic.