Export image api

From OpenStreetMap Wiki
Jump to navigation Jump to search

The export image button on the main OpenStreetMap website uses this "hidden" API to generate the images.

Base URL: https://render.openstreetmap.org/cgi-bin/export

It takes the following parameters:

  • bbox: The bounding box of the image, in the format min_lon,min_lat,max_lon,max_lat
  • scale: The scale of the image, in meters per pixel
  • format: The format of the image, either png, jpeg, webp, svg, pdf, or ps

Possible errors:

  • If your bbox or scale results in an image that has more than 4000000 pixels, you will get a 400 error with the message "Map too large". [1]
  • If the request didn't have a valid TOTP token, you will get a 400 error with the message "Missing or invalid token". [2]
  • If the CPU idle time on the machine is too low, you will get a 503 error with the message "The server is too busy at the moment. Please wait a few minutes before trying again."
  • If the bounding box is invalid, you will get a 400 error with the message "Invalid bounding box".
  • If the format is unknown, you will get a 400 error with the message "Unknown format".
  • If the CPU time limit is exceeded, you will get a 509 error with the message "CPU time limit exceeded".
  • If the memory limit is exceeded, you will get a 509 error with the message "Memory limit exceeded".
  • If there is an internal server error, you will get a 500 error with the message "Internal server error".

References

See also

export.erb - The code that handles the export image API on the OpenStreetMap servers.