Skip to main content
Notice removed Canonical answer required by André.B
Bounty Ended with xunilk's answer chosen by André.B
Notice added Canonical answer required by André.B
Bounty Started worth 50 reputation by André.B
additional information
Source Link
André.B
  • 193
  • 1
  • 13

I want to create a raster with a 25 metre × 25 metre resolution, where each cell contains the distance to the nearest coastline, as calculated from the center of the cell. To do this, all I have is a shapefile of the coastlines of New Zealand.

I have tried following Dominic Roye's tutorial for doing it in R which works... kind of. It is fine down to about a 1 km × 1 km resolution but if I try to go any higher the RAM it requires well exceeds that available on my PC (~ 70 gb of RAM required) or any other that I have access too. In saying that, I think this is a limitation of R and I suspect that QGIS might have a more computationally efficient way of creating this raster, but I am new to it and I can't quite figure out how to do it.

I have tried following Creating raster with distance to feature using QGIS? to create it in QGIS but it returns this error:

_core.QgsProcessingException: Could not load source layer for INPUT: C:/..../Coastline/nz-coastlines-and-islands-polygons-topo-150k.shp not found

and I am not sure why.

Does anyone have any suggestions of what might be going wrong or an alternative way of doing this?

Edit:

The raster I am hoping to produce would have about 59684 rows and 40827 columns so that it overlaps with the annual water deficit raster from LINZ. If the raster that is produced is larger than the annual water deficit raster I can snip it in R though...

One thing that I think might be a potential issue is that the shapefile of NZ's coastline has a large amount of sea between the islands, and I am not interested in calculating the distance to coast for these cells. I really only want to calculate the values for cells that are include some slice of land. I am not sure how to do this, or if it is an actually problem though.

I want to create a raster with a 25 metre × 25 metre resolution, where each cell contains the distance to the nearest coastline, as calculated from the center of the cell. To do this, all I have is a shapefile of the coastlines of New Zealand.

I have tried following Dominic Roye's tutorial for doing it in R which works... kind of. It is fine down to about a 1 km × 1 km resolution but if I try to go any higher the RAM it requires well exceeds that available on my PC (~ 70 gb of RAM required) or any other that I have access too. In saying that, I think this is a limitation of R and I suspect that QGIS might have a more computationally efficient way of creating this raster, but I am new to it and I can't quite figure out how to do it.

I have tried following Creating raster with distance to feature using QGIS? to create it in QGIS but it returns this error:

_core.QgsProcessingException: Could not load source layer for INPUT: C:/..../Coastline/nz-coastlines-and-islands-polygons-topo-150k.shp not found

and I am not sure why.

Does anyone have any suggestions of what might be going wrong or an alternative way of doing this?

I want to create a raster with a 25 metre × 25 metre resolution, where each cell contains the distance to the nearest coastline, as calculated from the center of the cell. To do this, all I have is a shapefile of the coastlines of New Zealand.

I have tried following Dominic Roye's tutorial for doing it in R which works... kind of. It is fine down to about a 1 km × 1 km resolution but if I try to go any higher the RAM it requires well exceeds that available on my PC (~ 70 gb of RAM required) or any other that I have access too. In saying that, I think this is a limitation of R and I suspect that QGIS might have a more computationally efficient way of creating this raster, but I am new to it and I can't quite figure out how to do it.

I have tried following Creating raster with distance to feature using QGIS? to create it in QGIS but it returns this error:

_core.QgsProcessingException: Could not load source layer for INPUT: C:/..../Coastline/nz-coastlines-and-islands-polygons-topo-150k.shp not found

and I am not sure why.

Does anyone have any suggestions of what might be going wrong or an alternative way of doing this?

Edit:

The raster I am hoping to produce would have about 59684 rows and 40827 columns so that it overlaps with the annual water deficit raster from LINZ. If the raster that is produced is larger than the annual water deficit raster I can snip it in R though...

One thing that I think might be a potential issue is that the shapefile of NZ's coastline has a large amount of sea between the islands, and I am not interested in calculating the distance to coast for these cells. I really only want to calculate the values for cells that are include some slice of land. I am not sure how to do this, or if it is an actually problem though.

Tweeted twitter.com/StackGIS/status/1175107453056425985
Became Hot Network Question
added 22 characters in body; edited title; added 6 characters in body
Source Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

How do I create a Creating raster where each cell records the distance to sea?

I want to create a raster with a 25 metre × 25 metre resolution, where each cell contains the distance to the nearest coastline, as calculated from the center of the cell. To do this, all I have is a shape fileshapefile of the coastlines of New Zealand.

I have tried following Dominic Roye's tutorial for doing it in R which works... kind of. It is fine down to about a 1 km × 1 km resolution but if I try to go any higher the RAM it requires well exceeds that available on my PC (~ 70 gb of RAM required) or any other that I have access too. In saying that, I think this is a limitation of R and I suspect that qGISQGIS might have a more computationally efficient way of creating this raster, but I am new to it and I can't quite figure out how to do it.

I have tried following this threadCreating raster with distance to feature using QGIS? to create it in qGISQGIS but it returns this error:

_core.QgsProcessingException: Could not load source layer for INPUT: C:/..../Coastline/nz-coastlines-and-islands-polygons-topo-150k.shp not found

_core.QgsProcessingException: Could not load source layer for INPUT: C:/..../Coastline/nz-coastlines-and-islands-polygons-topo-150k.shp not found

and I am not sure why.... 

Does anyone have any suggestions of what might be going wrong? Or or an alternative way of doing this?

How do I create a raster where each cell records the distance to sea?

I want to create a raster with a 25 metre × 25 metre resolution, where each cell contains the distance to the nearest coastline, as calculated from the center of the cell. To do this, all I have is a shape file of the coastlines of New Zealand.

I have tried following Dominic Roye's tutorial for doing it in R which works... kind of. It is fine down to about a 1 km × 1 km resolution but if I try to go any higher the RAM it requires well exceeds that available on my PC (~ 70 gb of RAM required) or any other that I have access too. In saying that, I think this is a limitation of R and I suspect that qGIS might have a more computationally efficient way of creating this raster, but I am new to it and I can't quite figure out how to do it.

I have tried following this thread to create it in qGIS but it returns this error:

_core.QgsProcessingException: Could not load source layer for INPUT: C:/..../Coastline/nz-coastlines-and-islands-polygons-topo-150k.shp not found

and I am not sure why.... Does anyone have any suggestions of what might be going wrong? Or an alternative way of doing this?

Creating raster where each cell records distance to sea?

I want to create a raster with a 25 metre × 25 metre resolution, where each cell contains the distance to the nearest coastline, as calculated from the center of the cell. To do this, all I have is a shapefile of the coastlines of New Zealand.

I have tried following Dominic Roye's tutorial for doing it in R which works... kind of. It is fine down to about a 1 km × 1 km resolution but if I try to go any higher the RAM it requires well exceeds that available on my PC (~ 70 gb of RAM required) or any other that I have access too. In saying that, I think this is a limitation of R and I suspect that QGIS might have a more computationally efficient way of creating this raster, but I am new to it and I can't quite figure out how to do it.

I have tried following Creating raster with distance to feature using QGIS? to create it in QGIS but it returns this error:

_core.QgsProcessingException: Could not load source layer for INPUT: C:/..../Coastline/nz-coastlines-and-islands-polygons-topo-150k.shp not found

and I am not sure why. 

Does anyone have any suggestions of what might be going wrong or an alternative way of doing this?

Source Link
André.B
  • 193
  • 1
  • 13

How do I create a raster where each cell records the distance to sea?

I want to create a raster with a 25 metre × 25 metre resolution, where each cell contains the distance to the nearest coastline, as calculated from the center of the cell. To do this, all I have is a shape file of the coastlines of New Zealand.

I have tried following Dominic Roye's tutorial for doing it in R which works... kind of. It is fine down to about a 1 km × 1 km resolution but if I try to go any higher the RAM it requires well exceeds that available on my PC (~ 70 gb of RAM required) or any other that I have access too. In saying that, I think this is a limitation of R and I suspect that qGIS might have a more computationally efficient way of creating this raster, but I am new to it and I can't quite figure out how to do it.

I have tried following this thread to create it in qGIS but it returns this error:

_core.QgsProcessingException: Could not load source layer for INPUT: C:/..../Coastline/nz-coastlines-and-islands-polygons-topo-150k.shp not found

and I am not sure why.... Does anyone have any suggestions of what might be going wrong? Or an alternative way of doing this?