Open pedro-andrade-inpe opened 3 years ago
The distance operation considering both centroids.
See it in attached image.
import("gis")
local proj = Project{
file = "project.qgs",
clean = true
}
local f1 = filePath("amazonia-limit.shp", "gis")
local f2 = filePath("amazonia-ports.shp", "gis")
f1:copy(currentDir())
f2:copy(currentDir())
local l1 = Layer{
project = proj,
name = "limit",
file = "amazonia-limit.shp"
}
print(l1)
local l2 = Layer{
project = proj,
name = "ports",
file = "amazonia-ports.shp"
}
print(l2)
l1:fill{
attribute = "dist",
operation = "distance",
layer = l2.name
}
So it is not to the border of a polygon. Just update this sentence, please.
@pedro-andrade-inpe Actually, it has been changed in #1566.
The strategy
distance
for polygons is not clear in the documentation. It says that " The distance is computed from the centroid of the cell to the closest point, line, or border of a polygon." What happens when the centroid is within the polygon?