I'm trying to subtract from one shapefile the portions of another which overlap using the following:
land.shp: subunits.shp lakes.shp COOKIE=subunits CUTTER=lakes; \ echo ''$$COOKIE'.shp'$$CUTTER'.shp' | \ ogr2ogr -f "ESRI Shapefile" \ land.shp /vsistdin/ \ -dialect sqlite \ -sql "SELECT ST_Difference($$COOKIE.geometry,$$CUTTER.geometry) AS geometry FROM $$COOKIE,$$CUTTER"lakes.shp: ne_10m_lakes.shp ogr2ogr \ -t_srs EPSG:4326 \ -clipdst -92.956317 49.113085 -74.952721 40.992926 \ lakes.shp \ ne_10m_lakes.shp \subunits.shp: ne_10m_admin_0_map_subunits.shp ogr2ogr \ -where "ADM0_A3 IN('CAN')" \ -t_srs EPSG:4326 \ subunits.shp \ ne_10m_admin_0_map_subunits.shp(Makefile, sorry about the long lines)
The result I'm getting is identical to the input. However, as a sanity check, when I reverse the order of the first line (COOKIE=lakes CUTTER=subunits) and leave everything else the same the result is what I'd expect: the US part of the lakes minus everything else. That suggests to me that the query itself is fine. Is there something else I might be missing?
TL;DR: I want the area of the polygon around the Great Lakes to follow the shoreline, not the int'l. border.
أكثر...
land.shp: subunits.shp lakes.shp COOKIE=subunits CUTTER=lakes; \ echo ''$$COOKIE'.shp'$$CUTTER'.shp' | \ ogr2ogr -f "ESRI Shapefile" \ land.shp /vsistdin/ \ -dialect sqlite \ -sql "SELECT ST_Difference($$COOKIE.geometry,$$CUTTER.geometry) AS geometry FROM $$COOKIE,$$CUTTER"lakes.shp: ne_10m_lakes.shp ogr2ogr \ -t_srs EPSG:4326 \ -clipdst -92.956317 49.113085 -74.952721 40.992926 \ lakes.shp \ ne_10m_lakes.shp \subunits.shp: ne_10m_admin_0_map_subunits.shp ogr2ogr \ -where "ADM0_A3 IN('CAN')" \ -t_srs EPSG:4326 \ subunits.shp \ ne_10m_admin_0_map_subunits.shp(Makefile, sorry about the long lines)
The result I'm getting is identical to the input. However, as a sanity check, when I reverse the order of the first line (COOKIE=lakes CUTTER=subunits) and leave everything else the same the result is what I'd expect: the US part of the lakes minus everything else. That suggests to me that the query itself is fine. Is there something else I might be missing?
TL;DR: I want the area of the polygon around the Great Lakes to follow the shoreline, not the int'l. border.
أكثر...