Open rafapereirabr opened 3 years ago
Web Features Services seems to be the right tool to make geobr data available.
A tutorial on how it works: https://docs.qgis.org/2.18/en/docs/training_manual/online_resources/wfs.html
I couldn't find a tutorial, though. Does anyone know how to build it?
I'm not familiar with Web Feature Services (WFS). What is the advanted of WFS instead of the plugin download the geopackage files into QGIS?
You do not need to develop a graphical interface, as the user will need only to configure how to access the data through the available funcionalities of QGIS. Additionally, the data will be available to any tool that can read this standard. The disadvantage is that you need a server to provide the data. Tipically we use Geoserver.
This might be a stupid comment from a newbie on the package, so please feel free to educate me. Perhaps we should step back a bit and define which problem exactly the plugin would solve on QGIS? I'd say the typical QGIS user would download the data, merge it with a shapefile and move on with his/her spatial analysis. In the Segreg plugin that I developed, the data is stored locally as a table of features that can be saved with the shapefile and reused later. Do you all have in mind cases where this data would be consumed without a shapefile? This contextualisation might also help others to hop in and contribute.
Hi @sandrofsousa . Thanks for chipping in. The aim of geobr is to help users easily and efficiently download official spatial data sets of Brazil. Currently, each data set is stored as a geopackage file at our server in Ipea. The Python and R packages basically download those geopackge files from the server given parameters of geography, year, etc etc. We currenly have over 3200 data files summing aprox. 16GB. This means that storaing the data set locally or withing the plugin / r/python pacakges is not an option.
The idea I have in mind for the QGIS plugin would be a simple interface to the Python package. So the user would select a few parameters (basically the same parameters used in the functions of the Python package), and the pluging would download the geopackage data and read it to memory.
Oh I see @rafapereirabr, thanks for clarifying. In fact your idea is exactly what I tough, but I failed to articulate it. By downloading I meant only the required data, not the full dataset. The idea proposed by @pedro-andrade-inpe and @JoaoCarabetta seems to be the way, I'll look into it.
As far as I understood, we have three options:
Advantages:
Drawbacks:
Advantages:
Drawbacks:
Advantages:
Drawbacks:
An important thing to note regarding data filters. When the user runs :
m <- geobr::read_municipality(code_muni = 4106902 )
the behavior of geobr is to first download one geopackage of all municipalities in the state 41
, and only then filter the data to keep the observations where code_muni = 4106902
. This means that geobr filters the data set locally. I wanted to clarify this point because it might affect what route we take from here give the 3 options listed by @JoaoCarabetta above.
Not being familiar with WFS nor Flask servers, I would prefer to stick with option 3. Do you guys know any other QGIS plugins that download data that I could have look at?
With option 3, the following plugins do something similar. They simply provide an interface that allows to navigate the dataset and select which table is needed, then, the data is saved as a QGIS virtual layer. istacqgis cbers4a
Developing the plugin interface is not a big issue, it's done using Qt I can help with that. I had a few breaking points when I updated my plugin from QGIS 2 to 3, besides that it is quite stable.
I also think that option 3 might be the easiest to implement and maintain.
@sandrofsousa do you mind building a POC that calls a geobr
API, maybe read_country
, so that we can start developing from there?
If you can, open a PR and add the plugin on a folder called qgis_plugin
.
I will work on that @JoaoCarabetta and open a PR when I get a minimal example working, it might take a while though :)
@sandrofsousa did you manage to work on it?
Maybe it would be interesting to make the data available as Web Feature Services (WFS).