Skip to main content
corrected spelling
Source Link
nmtoken
  • 13.6k
  • 5
  • 38
  • 89

I want to create a buffer of 5km around the coastline, and save that as a separate shape fileshapefile.

I have shape filea shapefile with almost 180,000 features. ItsIt's a line shape fileshapefile, representing the coastslinescoastlines of the world (I got the data here). The shape fileshapefile is in CRS (EPSG:4326, WG84).

So far I have been testing three approaches and all are either very slow or crash:

  1. QGIS 2.14.2 Essen (with functioning GRASS functions) I go to 'Vector' --> 'Geoprocessing Tools' --> 'Buffer(s)...' I select the shape fileshapefile, For buffer distance I use: 0.05 (EPSG:4326 which is about 5.5km) I check the 'Dissolve buffer results' options. This option doesn't seem to work, as QGIS crashes. I expect it has to do with a shortage of memory available. "Error: minidump written to (filepath)" [Screen shot of error message in QGIS2

  2. PgAdminIII 1.20.0 with the following state I try to create a new table and fill it with the buffer:

    CREATE TABLE public.lines_buffer AS SELECT ST_Buffer(geom,0.05) FROM public.lines

But the connection keeps on getting lost and thus breaking the operation. The furthest I got was 2 hours of query time, but that wasn't enough.

  1. Python 2.7 (shapely, fiona, descartes) My third attempt, is still in progress. I am trying to loop through the large shapefile and make a buffer. I'm not sure if my code is very efficient. I still have to "dissolve" after the buffer, which would also take a while. I plan on testing shapely.ops.cascaded_union. EDIT: Even running the first 2 items takes very long...[Spyder IDE: 100% memory usage] My current loop just limits the first 3 items in the fiona.collection Credits go to Tom Macwright

    def readshape(pathfolder, filename): filepath = os.path.join(pathfolder, filename) with collection(filepath) as Input: schema = Input.schema with collection('buffer_shape.shp', 'w', 'ESRI Shapefile', schema) as output: for i in range(0, 3): output.write({ 'properties': { 'source': Input[i]['properties']['source'] }, 'geometry': mapping(shape(Input[i]['geometry']).buffer(0.05)) })

Does anyone have any tips, which software is the quickest and most stable option?

I want to create a buffer of 5km around the coastline, and save that as a separate shape file.

I have shape file with almost 180,000 features. Its a line shape file, representing the coastslines of the world (I got the data here). The shape file is in CRS (EPSG:4326, WG84).

So far I have been testing three approaches and all are either very slow or crash:

  1. QGIS 2.14.2 Essen (with functioning GRASS functions) I go to 'Vector' --> 'Geoprocessing Tools' --> 'Buffer(s)...' I select the shape file, For buffer distance I use: 0.05 (EPSG:4326 which is about 5.5km) I check the 'Dissolve buffer results' options. This option doesn't seem to work, as QGIS crashes. I expect it has to do with a shortage of memory available. "Error: minidump written to (filepath)" [Screen shot of error message in QGIS2

  2. PgAdminIII 1.20.0 with the following state I try to create a new table and fill it with the buffer:

    CREATE TABLE public.lines_buffer AS SELECT ST_Buffer(geom,0.05) FROM public.lines

But the connection keeps on getting lost and thus breaking the operation. The furthest I got was 2 hours of query time, but that wasn't enough.

  1. Python 2.7 (shapely, fiona, descartes) My third attempt, is still in progress. I am trying to loop through the large shapefile and make a buffer. I'm not sure if my code is very efficient. I still have to "dissolve" after the buffer, which would also take a while. I plan on testing shapely.ops.cascaded_union. EDIT: Even running the first 2 items takes very long...[Spyder IDE: 100% memory usage] My current loop just limits the first 3 items in the fiona.collection Credits go to Tom Macwright

    def readshape(pathfolder, filename): filepath = os.path.join(pathfolder, filename) with collection(filepath) as Input: schema = Input.schema with collection('buffer_shape.shp', 'w', 'ESRI Shapefile', schema) as output: for i in range(0, 3): output.write({ 'properties': { 'source': Input[i]['properties']['source'] }, 'geometry': mapping(shape(Input[i]['geometry']).buffer(0.05)) })

Does anyone have any tips, which software is the quickest and most stable option?

I want to create a buffer of 5km around the coastline, and save that as a separate shapefile.

I have a shapefile with almost 180,000 features. It's a line shapefile, representing the coastlines of the world (I got the data here). The shapefile is in CRS (EPSG:4326, WG84).

So far I have been testing three approaches and all are either very slow or crash:

  1. QGIS 2.14.2 Essen (with functioning GRASS functions) I go to 'Vector' --> 'Geoprocessing Tools' --> 'Buffer(s)...' I select the shapefile, For buffer distance I use: 0.05 (EPSG:4326 which is about 5.5km) I check the 'Dissolve buffer results' options. This option doesn't seem to work, as QGIS crashes. I expect it has to do with a shortage of memory available. "Error: minidump written to (filepath)" [Screen shot of error message in QGIS2

  2. PgAdminIII 1.20.0 with the following state I try to create a new table and fill it with the buffer:

    CREATE TABLE public.lines_buffer AS SELECT ST_Buffer(geom,0.05) FROM public.lines

But the connection keeps on getting lost and thus breaking the operation. The furthest I got was 2 hours of query time, but that wasn't enough.

  1. Python 2.7 (shapely, fiona, descartes) My third attempt, is still in progress. I am trying to loop through the large shapefile and make a buffer. I'm not sure if my code is very efficient. I still have to "dissolve" after the buffer, which would also take a while. I plan on testing shapely.ops.cascaded_union. EDIT: Even running the first 2 items takes very long...[Spyder IDE: 100% memory usage] My current loop just limits the first 3 items in the fiona.collection Credits go to Tom Macwright

    def readshape(pathfolder, filename): filepath = os.path.join(pathfolder, filename) with collection(filepath) as Input: schema = Input.schema with collection('buffer_shape.shp', 'w', 'ESRI Shapefile', schema) as output: for i in range(0, 3): output.write({ 'properties': { 'source': Input[i]['properties']['source'] }, 'geometry': mapping(shape(Input[i]['geometry']).buffer(0.05)) })

Does anyone have any tips, which software is the quickest and most stable option?

edited title
Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

Large shapefile: Best approach to buffer Buffer and union of large shapefile?

added 88 characters in body
Source Link
J.A.Cado
  • 347
  • 4
  • 13
  1. Python 2.7 (shapely, fiona, descartes) My third attempt, is still in progress. I am trying to loop through the large shapefile and make a buffer. I'm not sure if my code is very efficient. I still have to "dissolve" after the buffer, which would also take a while. I plan on testing shapely.ops.cascaded_union.

    Python 2.7 (shapely, fiona, descartes) My third attempt, is still in progress. I am trying to loop through the large shapefile and make a buffer. I'm not sure if my code is very efficient. I still have to "dissolve" after the buffer, which would also take a while. I plan on testing shapely.ops.cascaded_union. EDIT: Even running the first 2 items takes very long...[Spyder IDE: 100% memory usage] My current loop just limits the first 3 items in the fiona.collection Credits go to Tom Macwright

    def readshape(pathfolder, filename): filepath = os.path.join(pathfolder, filename) with collection(filepath) as Input: schema = Input.schema with collection('buffer_shape.shp', 'w', 'ESRI Shapefile', schema) as output: for i in range(0, 3): output.write({ 'properties': { 'source': Input[i]['properties']['source'] }, 'geometry': mapping(shape(Input[i]['geometry']).buffer(0.05)) })

My current loop just limits the first 3 items in the fiona.collection Credits go to Tom Macwright

def readshape(pathfolder, filename):
filepath = os.path.join(pathfolder, filename)
with collection(filepath) as Input:
    schema = Input.schema
    with collection('buffer_shape.shp', 'w', 'ESRI Shapefile', schema) as output:
        for i in range(0, 3):
            output.write({
                'properties': {
                    'source': Input[i]['properties']['source']
                },
                'geometry': mapping(shape(Input[i]['geometry']).buffer(0.05))
            })
  1. Python 2.7 (shapely, fiona, descartes) My third attempt, is still in progress. I am trying to loop through the large shapefile and make a buffer. I'm not sure if my code is very efficient. I still have to "dissolve" after the buffer, which would also take a while. I plan on testing shapely.ops.cascaded_union.

My current loop just limits the first 3 items in the fiona.collection Credits go to Tom Macwright

def readshape(pathfolder, filename):
filepath = os.path.join(pathfolder, filename)
with collection(filepath) as Input:
    schema = Input.schema
    with collection('buffer_shape.shp', 'w', 'ESRI Shapefile', schema) as output:
        for i in range(0, 3):
            output.write({
                'properties': {
                    'source': Input[i]['properties']['source']
                },
                'geometry': mapping(shape(Input[i]['geometry']).buffer(0.05))
            })
  1. Python 2.7 (shapely, fiona, descartes) My third attempt, is still in progress. I am trying to loop through the large shapefile and make a buffer. I'm not sure if my code is very efficient. I still have to "dissolve" after the buffer, which would also take a while. I plan on testing shapely.ops.cascaded_union. EDIT: Even running the first 2 items takes very long...[Spyder IDE: 100% memory usage] My current loop just limits the first 3 items in the fiona.collection Credits go to Tom Macwright

    def readshape(pathfolder, filename): filepath = os.path.join(pathfolder, filename) with collection(filepath) as Input: schema = Input.schema with collection('buffer_shape.shp', 'w', 'ESRI Shapefile', schema) as output: for i in range(0, 3): output.write({ 'properties': { 'source': Input[i]['properties']['source'] }, 'geometry': mapping(shape(Input[i]['geometry']).buffer(0.05)) })

Source Link
J.A.Cado
  • 347
  • 4
  • 13
Loading