0

I want to get image from "http://www.openstreetmap.org/export/finish" or "http://api06.dev.openstreetmap.org/export/finish" with Python.

I tried this command.

import requests

url = "http://www.openstreetmap.org/export/finish" <br />
r = requests.post(url,{'mapnik_format': 'png', 'minlon': 135.74, 'minlat': 35.011, 'maxlon': 135.75, 'maxlat': 35.014, 'format': 'mapnik', 'mapnik_scale': 30000})

but r is Response [400] and r.content is this

<html>
<head>
<title>Error</title>
</head>
<body>
<h1>Error</h1>
<p>Missing or invalid token</p>
</body>
</html>

Why I can't get image? How should I do?

asked 04 Jan '17, 05:35

taki_'s gravatar image

taki_
11113
accept rate: 0%

edited 04 Jan '17, 07:59

scai's gravatar image

scai ♦
31.9k20291442


One Answer:
1

The export facility on the web site is not meant to be used programmatically. (See https://operations.osmfoundation.org/policies/tiles/ which says "Calls to /cgi-bin/export may only be triggered by direct end-user action." - even though you're not calling /cgi-bin/export this is the same thing.)

So even if the problem you are seeing could be fixed, you'd be using the interface in disregard of the policy.

Generally the best and most reliable way to generate static map images is to run your own rendering server - that way you can make as many requests as you like and you're not killing anyone else's server with it. If you absolutely must use a hosted service, have a look at http://wiki.openstreetmap.org/wiki/Static_map_images but be aware that the services listed there are not suitable for massive use either.

permanent link

answered 04 Jan '17, 09:53

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
73.3k866641137
accept rate: 24%

Oh, I see. Thank you.

(10 Jan '17, 13:19) taki_

Well, the same error occurs from the web gui when trying to export a page, to any format.

(29 Mar '17, 22:38) quazgar

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:

×322
×287
×250
×53

question asked: 04 Jan '17, 05:35

question was seen: 2,520 times

last updated: 29 Mar '17, 22:38

powered by OSQA