ropensci / osmextract

Download and import OpenStreetMap data from Geofabrik and other providers
https://docs.ropensci.org/osmextract
GNU General Public License v3.0
170 stars 12 forks source link

Simplifying queries #239

Open Robinlovelace opened 2 years ago

Robinlovelace commented 2 years ago

Many of the examples in the documents show queries like this:

q = "SELECT * FROM 'multipolygons' WHERE 'building' is not null"

However, I've just discovered that this works fine (better in this case, the above fails to omit building=NA):

In context of reprex:

library(dplyr)
q = "SELECT * FROM multipolygons WHERE building is not null"
buildings_nyorks = osmextract::oe_get("north yorkshire", query = q)
buildings_nyorks %>%
  sf::st_drop_geometry() %>% 
  group_by(building) %>% 
  count(building) %>% 
  arrange(desc(n))
Robinlovelace commented 2 years ago

Result!

image

agila5 commented 2 years ago

Hi Robin! I'm not 100% sure but I think that sounds like a bug (or at least something that I want to check with more details as soon as possible). Anyway, thanks for creating this issue!