Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vector tools access #7

Open
TimotheeMichon opened this issue Mar 17, 2017 · 4 comments
Open

Vector tools access #7

TimotheeMichon opened this issue Mar 17, 2017 · 4 comments

Comments

@TimotheeMichon
Copy link

Hello everyone,

I am interested to using supplementary tools for vector processing, in order to extract a boundary of a given DTM already converted in polygon, but which i would apply some buffer function.

I have noticed that in the main.cfg file, some vector tools are mentioned which would be helpful for me:
[vectorTools] alias=Buffer,BufferMask,Centroid,Boundary,ConvexHull,Simplify,SpatialQuery name=buffer,spatial-buffer,centroid,boundary,convexhull,simplify,spatial-query title=Vector Tools
Is there a solution for accessing these particular tools in the map-mint interface ?

To summarize starting from the raster in the first picture, i want to get to the shape of the boundaries like in the third picture (the second picture is the result of the gdal_polygonize.py function):
capture d ecran 2017-03-17 a 10 26 45
capture d ecran 2017-03-17 a 10 26 55
capture d ecran 2017-03-17 a 10 26 55-01

If you have better idea to do so, i would also be grateful.

Thanks

@gfenoy
Copy link
Member

gfenoy commented Mar 17, 2017

Dear Timothée,
thanks for providing continuous feedbacks.

Indeed we have in the ZOO-Project the OGR basic-vector-operations such as Buffer, Centroid, and so on available from the MapMint platform. By now this can be used only from the client interface. It means that you can activate for a project the vector tools you need to have in your client application. But in your specific case, I suppose that you need to use the Buffer service directly from the administration interface. If this is the case then I can easily add this capability to the administration interface.

Personally, when I had to create the polygon defining the boundaries of your raster files I used the following command line:

for i in /var/data/dirs/tmpMeteo/*FilledDTM.asc ; do j=$(echo $i | sed "s:/var/data/dirs/tmpMeteo/::g"); gdal_translate -co compress=lzw -b 1 -ot byte -scale 1 1 
$i $(echo $j | sed "s:asc:tif:g") ; gdal_polygonize.py $(echo $j | sed "s:asc:tif:g") -f "ESRI Shapefile" $(echo $j | sed "s:asc:shp:g") ;done
for i in *shp ; do j=$(echo $i | sed "s:.shp::g"); ogr2ogr -a_srs "+init=IGNF:LAMB93" -append polygon_list.shp $i -sql "SELECT * FROM $j  WHERE DN!=0" -nln polygon_list ;done

The first step will create simplified raster files by creating a raster file containing only 0 or 1 depending if there is a value in the pixel or not. In case there is a value then we set 1 in other case we set 0 for the pixel. The we create one shape file using the gdal_polygonize.py tool to create the extent of one raster file, then we loop over every raster files.

The second step consists in creating a shape file containing all the previously created polygons.

I hope this helps and answer your question.

Best regards.

@TimotheeMichon
Copy link
Author

Dear Gerald,

I have tried your solution and this seems to do exactly that i want !

Simplifying the raster file by creating a raster file containing only 0 or 1 depending if there is a value in the pixel or not, was definitely the good idea.

Many thanks !

@gfenoy
Copy link
Member

gfenoy commented Mar 17, 2017

Note that in case you would like to see this functionality added to the Distiller administrator panel this can be easily done. Indeed, the Gdal_Translate ZOO-Service already exists and can then be used "as-is". The only requirement will be to create a gdal_polygonize.py ZOO-Service that cn be done really easily.

If we go this way, it means that an administrator can do the extractions of multiple raster files (or a single one) by selecting them from the datastore where they stand. Then as we can create a mosaic or a tile index, you can then access to a HTML form asking for the datastore to store your raster boundaries and also the name of the datasource to create. Then you can simply press the submit button to have your datasource created.

It looks very simple to implement to implement and integrate into the Distiller module and it looks to be the right place to place it as it is the place where you brew your data before creating maps based on the processed data.

I hope to hear back from you.

Best regards.

@gfenoy
Copy link
Member

gfenoy commented Mar 17, 2017

Sorry I have forgotten to mention that in case you would like to have access to the vector tools directly from the Distiller it can also be easily added.

In such a case we should still think of integrating more complexe algorithms too, such as OTB services for exemple.

Obviously the OTB support will be optional, meaning that only users that have setup OTB and built the ZOO-Kernel linking against the OTB libraries will be able to access those new capabilities obviously.

This can be really easy to implement by reusing the automatic HTML forms generation as we are using the OTB demo online application available on the ZOO-Project web site (http://zoo-project.org/examples/otb-example.html) or OSGeoLiveDVD.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants