Cut polygons from map units data (10m)

Home Forums Natural Earth Map Data Cultural Vectors Cut polygons from map units data (10m)

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #3843

    WrinkledCheese
    Participant

    Hello 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.

     

    #4459

    Nathaniel
    Keymaster

    @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/

    #4460

    WrinkledCheese
    Participant

    Thanks 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.

    #4461

    Nathaniel
    Keymaster

    Why can’t you overlay the lakes so it looks like it’s cutting out the admin graphically?

    #4462

    WrinkledCheese
    Participant

    I 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.

    #4463

    WrinkledCheese
    Participant

    One 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.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.