NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

I'm working on a project that downloads data from openstreetmap with R-Studio.

Fehler in check_for_error(doc) : General overpass server error; returned: The data included in this document is from www.openstreetmap.org. The data is made available under ODbL. runtime error: Query timed out in "query" at line 5 after 26 seconds.

But every time I try to download data, I get this Error-code. Could you explain to me, what it means and how I could fix the problem. I would really appreciative, if you could help me.

asked 16 Apr '21, 16:24

Michael23's gravatar image

Michael23
11112
accept rate: 0%

1

Your query could ask for too many data. Why don't you post the relevant bit of code with the query?

(17 Apr '21, 10:15) TZorn

In the answer section you can find my script. It would really help me out, if you could help me to find the problem.

(17 Apr '21, 14:15) Michael23

Hello,

I don't know any R programming, but the bbox = "bb" looks problematic. You need to specify coordinates. Or maybe it's a placeholder ?

If you try to load every landuse=forest in the world, it will fail without doubt.

Using overpass, you can load either really specific data (by name, or reference for exemple) worldwide, or specify a small bounding box. Exceeding one or the other limit will meet the timeout.

You should try your overpass requests with overpass-turbo IMHO. You'll understand much more easily what is going on under the hood.

For example this query does what you're wishing, I think. I just used the convenient Assistant. Try to load it in your area of interest, to see if it works.

Also, you should be aware that natural=wood is nearly a synonym to landuse=forest, so you should probably load both, like in this query. See the wiki for more details.

If you want to make worldwide, or even countrywide, analysis, you'll have to download the raw osm data, and work locally.

Regards.

permanent link

answered 17 Apr '21, 16:33

H_mlet's gravatar image

H_mlet
5.4k1781
accept rate: 13%

Here is the script as far as it goes, until I receive the error-code. If you could make out the problem, that would be really helpful.

library(osmdata)
library(sf)
library(sp)
library(rgdal)

# Reading Data 
LostLetterFairtrade0221<-readRDS("~/Documents/Forschungsseminar/LostLetterFairtrade0221.rds")

# Funktion to Convert from wgs84 to UTM
WGS.to.UTM<-function(long, lat, utm.zone){
  utm.zone=as.character(utm.zone)
  if(length(utm.zone)==1){utm.zone=rep(utm.zone, length(long))}
  coords=data.frame(long, lat)
  names(coords)=c("long","lat")
  #prepare map for conversion to UTM:
  coordinates(coords)<-c("long","lat")
  coords@proj4string=CRS("+proj=longlat +datum=WGS84")
  #deterine parameters of the transformation:
  #browser()
  transf.param=unlist(lapply(utm.zone, function(x){
    CRS(paste("+proj=utm +zone=", x ," +datum=WGS84", sep=""))
  }))
  #... and transform it to UTM
  new.coords=lapply(1:length(coords), function(x){
    spTransform(coords[x,], transf.param[[x]])@coords
  })
  new.coords=as.data.frame(matrix(unlist(new.coords), ncol=2, byrow=T))
  names(new.coords)=c("long", "lat")
  #new.coords$lat[new.coords$lat<0]=10000000-new.coords$lat[new.coords$lat<0]
  return(new.coords)
}

#### UTM-Koordinaten for the letters
utm33n_llocs=WGS.to.UTM(long=LostLetterFairtrade0221$long, lat=LostLetterFairtrade0221$lat, utm.zone="33N")

LostLetterFairtrade0221$long_utm33n=utm33n_llocs$long
LostLetterFairtrade0221$lat_utm33n=utm33n_llocs$lat

api_list <- c('https://overpass.kumi.systems/api/interpreter')
api_to_use <- sample(1:length(api_list), 1)

set_overpass_url(api_list[api_to_use])

#### Waldflächen ziehen
forest <- opq(bbox = "bb") %>%
  add_osm_feature(key = 'landuse', value = "forest") %>%
  osmdata_sf () %>%
  trim_osmdata ("bb")

forest_points=forest$osm_points[1]
permanent link

answered 17 Apr '21, 14:14

Michael23's gravatar image

Michael23
11112
accept rate: 0%

edited 17 Apr '21, 16:19

H_mlet's gravatar image

H_mlet
5.4k1781

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×483
×362
×293
×123

question asked: 16 Apr '21, 16:24

question was seen: 2,732 times

last updated: 17 Apr '21, 16:33

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum