Friday, 15 June 2018

postgis - GRASS v.hull for many point sets


I have map "my_pointmap" with 3D points with ids=(1,2,3...N). I have also list of subsets of these point ids , S = [(1,2,3,4),(2,4,10,12), ...]. I would love to get GRASS GIS vector map with |S| 3D convex hulls.


for s in S:
s_ids_string = ",".join(map(str, s))
gscript.run_command('v.hull',

input="my_pointmap",
output="my_hullmap",
layer = 1,
where = "id in ("+s_ids_string +")")

This of course works only for the first iteration. The second one throws error that the layer "my_hullmap" already exists. I could create |S| maps called "my_hullmap_%s". But since S is quite long, I would end up with humongous number of maps.


Note: Since ST_Hull in PostGIS is not doing what it should/could, I am here. Once I will have the map of 3D hulls, I will use v.out.postgis to store it back to postgis.




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...