OSGeo / grass-addons

GRASS GIS Addons Repository
https://grass.osgeo.org/grass-stable/manuals/addons/
GNU General Public License v2.0
98 stars 148 forks source link

r.in.vect: new addon to import a vector map as raster layer #1143

Closed ecodiv closed 3 weeks ago

ecodiv commented 1 month ago

The addon offers an alternative to importing a vector layer and then converting the vector to raster. With this addon, the input vector file is converted to a raster layer using gdal.Rasterize. The resulting raster is imported in GRASS GIS. This can speed up the whole process considerably if one only wants to work with the raster.

If the CRS of the vector layer differs from the current mapset, it will first be reprojected using ogr2ogr. By default, the addon respects the region settings, but the user can opt to create a raster layer matching the extent of the vector map.

ecodiv commented 1 month ago

Thanks @ecodiv! I only checked the manual :)

The suggested name sounds a bit cryptic to me. The extern part of it sounds odd, why not just external? In any case, while I understand why the reference to external (it is converted outside GRASS), it is confusing if we think of the r.external and v.external modules that link the data instead of importing it.

What about... (drums)... v.in.rast? The input is a vector hence the v, the in as usual for import tools and rast because the output is a raster :)

@veroandreo I like the drums, it makes the suggested name sound even better :-). I'll change the name of the folder and files when back from the holidays. I b.t.w. checked the addon quickly on Windows, and got an error message. So need to check what goes wrong there. If you happen to have time to check, just to see if it is not my machine?

ecodiv commented 1 month ago

I b.t.w. checked the addon quickly on Windows, and got an error message. So need to check what goes wrong there. If you happen to have time to check, just to see if it is not my machine?

It does actually work with 8.3.2 (I tried with 8.5dev before).

petrasovaa commented 1 month ago

I know I am coming to this late, but I am not sure about the name... v.in.rast to me suggests the output is a vector, not raster, like v.in.ascii. So r.in.vect would make more sense to me, maybe r.in.vect.gdal...

ecodiv commented 1 month ago

Hi @petrasovaa and @veroandreo I haven't a real preference, both your naming suggestions have their merits. I would like to merge it soon, so let me know if I should change the name.

veroandreo commented 1 month ago

Hi @petrasovaa and @veroandreo I haven't a real preference, both your naming suggestions have their merits. I would like to merge it soon, so let me know if I should change the name.

I like Anna's suggestion, it is more in line with the *.in.* tools. My thinking was that the first letter in a tool's name (most of the times) refers to the input data type (not the output) because it defines the tool's group (i.*, v.*, r.*). But I didn't think of v.in.ascii or other in tools in which that logic is somehow(?) the opposite.

ecodiv commented 4 weeks ago

Hi @petrasovaa and @veroandreo I haven't a real preference, both your naming suggestions have their merits. I would like to merge it soon, so let me know if I should change the name.

I like Anna's suggestion, it is more in line with the .in. tools. My thinking was that the first letter in a tool's name (most of the times) refers to the input data type (not the output) because it defines the tool's group (i., v., r.*). But I didn't think of v.in.ascii or other in tools in which that logic is somehow(?) the opposite.

OK, I'll change the name to r.in.vect