Last active
February 13, 2020 04:25
-
-
Save robbibt/e9582da28b7441222272719245abfe04 to your computer and use it in GitHub Desktop.
Downloading DEA Hotspots data via WFS in R
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Set up parameters to load Hotspots data | |
| from_date = '2020-01-27' | |
| to_date = '2020-02-12' | |
| y_max = -35.38 | |
| x_min = 148.68 | |
| y_min = -36.02 | |
| x_max = 149.32 | |
| min_confidence = 0 # minimum confidence value of hotspots to load from WFS | |
| max_features = 900000 # maximum features to load from WFS | |
| # Generate custom WFS query (`glue` will insert the params above into the string) | |
| wfs_string = "https://hotspots.dea.ga.gov.au/geoserver/public/wfs?service=WFS&version=1.1.0&request=GetFeature&typeName=public:hotspots&outputFormat=application/json&CQL_FILTER=((sensor=%27AVHRR%27%20AND%20(product=%27SRSS%27))%20OR%20(sensor=%27MODIS%27%20AND%20(product=%27MOD14%27))%20OR%20(sensor=%27VIIRS%27%20AND%20(product=%27AFMOD%27%20OR%20product=%27EDR%27)))%20AND%20datetime%20%3E%20%27{from_date}%27%20AND%20datetime%20%3C%20%27{to_date}%27%20AND%20INTERSECTS(location,%20POLYGON(({y_min}%20{x_min},%20{y_min}%20{x_max},%20{y_max}%20{x_max},%20{y_max}%20{x_min},%20{y_min}%20{x_min})))&maxFeatures={format(max_features, scientific=FALSE)}&startIndex=0&sortBy=sensor%20A" | |
| url = glue::glue(wfs_string) | |
| # Load json data from WFS query as an sf dataframe | |
| hotspots_sf = sf::read_sf(url) | |
| # Plot data | |
| plot(hotspots_sf) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment