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

I'm making an http get request this way, in angular:

this.http.get('http://www.overpass-api.de/api/xapi?*[amenity=hospital][bbox=13.20524,43.70861,13.22842,43.72338]')
.subscribe(
data => {
    console.log(data.toString());
 });

but the following error is given:

Cannot read property 'toString' of null

I've also tried mapping the result this way:

this.http.get('http://www.overpass-api.de/api/xapi?*[amenity=hospital][bbox=13.20524,43.70861,13.22842,43.72338]')
.map(res => res.toString())
.subscribe(
data => {
    console.log(data);
 });

but the error remains. The xapi file I get if I go to http://www.overpass-api.de/api/xapi?*[amenity=hospital][bbox=13.20524,43.70861,13.22842,43.72338] is not null, so I'm supposing the method can't read the xapi file. Is there a way I can convert it to xml file?

asked 11 Aug '17, 17:32

PachiEPap's gravatar image

PachiEPap
11334
accept rate: 0%


The resulting file is a XML file. Just open the URL in your browser, save the file and open it in you favorite editor. Either a bug in your code. Or you have too many requests against this Overpass API server. In the latter case an error message will be returned. Either way, take a look at the content of the file.

permanent link

answered 12 Aug '17, 08:59

scai's gravatar image

scai ♦
33.3k21309459
accept rate: 23%

The content of the file is ok as said, so I don't know why the method can't read it. I've tried using interpreter for obtaining a json output, using this: https://www.overpass-api.de/api/interpreter?data=[out:json];node[amenity=bar](43.70861,13.20524,43.72338,13.22842);out%20meta; Even now, in the browser the result is ok, but the same error is shown

(12 Aug '17, 12:27) PachiEPap
1

You need to ask somebody with angular.js as it is nearly sure that your code is broken.

(12 Aug '17, 15:08) SimonPoole ♦
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:

×3

question asked: 11 Aug '17, 17:32

question was seen: 1,633 times

last updated: 12 Aug '17, 15:08

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