3dgeo-heidelberg / pytreedb

Python package providing a file and object-based database to store tree objects.
Other
28 stars 4 forks source link

get data from R with chained criteria #121

Open wiesehahn opened 1 year ago

wiesehahn commented 1 year ago

I am trying to load the data from R. There is the script under https://github.com/3dgeo-heidelberg/pytreedb/blob/224339bc03918aadeed4ca1345ce9feeb312536f/examples_api/example.R which works as expected. However, with the UI on https://pytreedb.geog.uni-heidelberg.de/ its possible to chain multiple criteria for queries. This seems not possible with the cript in R, or is it possible?

bhoefle-3dgeo commented 1 year ago

Dear @wiesehahn, you are right that the example R script is not fully supporting all the options of the web portal. Of course, every R crack is kindly invited to extend it to do so.

However, it is also easily possible to link the R script with the web portal search via line 40, where the derived GeoJSON is processed. Thus, you can easily create your query online, download / copy-paste the geosjson of your more sophisticated pytreedb query and insert the geojson content there.

Alternatively, you can also create the query like documented here and access the API directly: https://github.com/3dgeo-heidelberg/pytreedb/tree/main/webserver#deployment-for-local-dev. For example, passing as req in the R POST request if you point to the /search endpoint of the API (following MongDB query standards):

{"properties.species": "Abies alba"}