Exporting Map to PNG

I’m new to OpenStreetMap. I’m working on a project to create open data layers for the US for race and income with an extremely high level of resolution: www.justicemap.org (beta)

I’m using the Google Maps API, however their terms of service do not allow for static image exports. For starters, I want users to be able to create a map (including both a census map tile layer and a baseline street map) and export it to PNG. How can I do this with OpenStreetMap?

My map tiles (created in TileMill’s version of Mapnik) are in the standard 256x256 format and use the Google Mercator projection.

Ideally I’d like users to be able to customize the map by placing markers (and possibly shapes - like circles, lines, polygons). Does OpenStreetMap have a library for doing this? Does OSM have a KML or GeoJSON export function that can handle user added shapes?

Best source for hints about your aims should be the OSM wiki: http://wiki.osm.org

do a search there for: Rendering, Leaflet, OpenLayers (Hint to new OpenLayers3), Static map images, OSM on paper, KML, Export, MapBox

Aks here again about any concrete problen that you may encounter.

Also helpful: http://help.osm.org

I would suggest using QGIS with the OpenLayers plugin which allows you to overlay geodata over various OSM (and other tile supplier) layers. The Map Composer in QGIS allows one to produce high quality annotated output (e.g., with map legends) in PNG & PDF formats for further distribution.

If you want even more control then you can pull in OSM data and render this in QGIS along with your own data. (Currently the way I do this is to pull in a separate QGIS project for the base-level rendering).

Other tools tend to be directed at rendering OSM specific things directly rather than supporting use of OSM as a contextual layer. Please remember that with OSM the outputs must bear the attribution statement : “copyright OSM contributors”.

Thanks for the recommendations. OpenLayers3 has export and I’ll give it a try. Or should I stick with the non-beta OpenLayers?

I might use html2canvas - which allows me to export my existing map to an image. And was very easy to implement.

Nice Post reply, thank you for the recommendations stephan75