All Projects → CartoDB → carto-print

CartoDB / carto-print

Licence: BSD-3-Clause license
A Python module to export images at any resolution, size and bounding box from a CARTO named map:

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to carto-print

mini-map-maker
A tool for automatically generating 3D printable STLs from freely available lidar scan data.
Stars: ✭ 51 (+183.33%)
Mutual labels:  maps, printing
OL3-AnimatedCluster
OL3-AnimatedCluster is now part of the ol-ext project
Stars: ✭ 65 (+261.11%)
Mutual labels:  maps
mapmint
Fast and easy webmapping.
Stars: ✭ 51 (+183.33%)
Mutual labels:  maps
Google-Maps-Direction
Google Maps Direction
Stars: ✭ 38 (+111.11%)
Mutual labels:  maps
Avenue-GPX-Viewer
A simple and easy GPX viewer for macOS.
Stars: ✭ 42 (+133.33%)
Mutual labels:  maps
MapML
Map Markup Language is hypertext for Web maps, like HTML is hypertext for Web pages https://maps4html.org/MapML/spec/
Stars: ✭ 48 (+166.67%)
Mutual labels:  maps
vue-mapfit
A SSR compatible vue component which provides a Maps View with Mapfit
Stars: ✭ 12 (-33.33%)
Mutual labels:  maps
mapus
A map tool with real-time collaboration 🗺️
Stars: ✭ 2,687 (+14827.78%)
Mutual labels:  maps
Dual-color-Polyline-Animation
This library will help to show the polyline in dual color similar as Uber.
Stars: ✭ 73 (+305.56%)
Mutual labels:  maps
vallang
Generic immutable recursive data representation API targeted at source code models and more.
Stars: ✭ 28 (+55.56%)
Mutual labels:  maps
ipp.rs
IPP protocol implementation for Rust
Stars: ✭ 24 (+33.33%)
Mutual labels:  printing
map-kit-android
An extensive framework for map development in Android.
Stars: ✭ 44 (+144.44%)
Mutual labels:  maps
InterviewBit
Collection of solution for problems on InterviewBit
Stars: ✭ 77 (+327.78%)
Mutual labels:  maps
Java
"Always choose a lazy person to get the job done. A lazy person will always find the easy way out."
Stars: ✭ 16 (-11.11%)
Mutual labels:  maps
pix2pix
PyTorch implementation of Image-to-Image Translation with Conditional Adversarial Nets (pix2pix)
Stars: ✭ 36 (+100%)
Mutual labels:  maps
ModManager
Among Us Mod Manager
Stars: ✭ 44 (+144.44%)
Mutual labels:  maps
Samples-NET.Core-MVC-CSharp
ASP.NET Core 2.0 MVC C# samples for Stimulsoft Reports.Web reporting tool.
Stars: ✭ 28 (+55.56%)
Mutual labels:  maps
crisis-news-mapper
日本の災害関連ニュースをTwitterから収集して地図上にマッピングするFirebaseプロジェクト crisis.yuiseki.net
Stars: ✭ 13 (-27.78%)
Mutual labels:  maps
spider
A powful outdoor GPS track editor
Stars: ✭ 15 (-16.67%)
Mutual labels:  maps
maps4cim
maps4cim - a real world map generator for CiM 2
Stars: ✭ 21 (+16.67%)
Mutual labels:  maps

carto-print

A Python module to export images at any resolution, size and bounding box from a CARTO named map:

Installation

You can install carto-print by cloning this repository or by using Pip:

pip install carto-print

If you want to use the development version, you can install directly from github:

pip install -e git+git://github.com/CartoDB/carto-print.git#egg=carto

If using, the development version, you might want to install dependencies as well:

pip install -r requirements.txt

Only tested in Python 3

Usage Example

Command Line Tool

usage: carto-print [-h] [--api-key API_KEY] [--dpi DPI] [--img-format FORMAT]
                   [--output-dir DIR] [--server-url URL]
                   USER MAP_TPL WIDTH_CM HEIGHT_CM ZOOM BOUNDING_BOX

Exports images at any resolution, size and bounding box from a CARTO named
map.

positional arguments:
  USER                 CARTO user name
  MAP_TPL              map template or named map name
  WIDTH_CM             width in cm
  HEIGHT_CM            height in cm
  ZOOM                 zoom level
  BOUNDING_BOX         bounding box: south,west,north,east (min lon, min lat,
                       max lon, max lat)

optional arguments:
  -h, --help           show this help message and exit
  --api-key API_KEY    CARTO api_key (default: default_public)
  --dpi DPI            output image DPI (default: 72)
  --img-format FORMAT  output image format: RGBA, CMYK (default: RGBA)
  --output-dir DIR     output directory (default: current one)
  --server-url URL     server base URL, should contain the token {username}
                       (default: https://{username}.carto.com)

In this example we are exporting a 300 dpi and 30x20 cm image of the Paris flood map:

carto-print aromeu tpl_87c5667f_3eb5_4a19_9300_b39a2d1970d1 30 20 12 1.956253,48.711127,2.835159,49.012429 --dpi 300 --img-format CMYK --output-dir /tmp

For bounding boxes starting with negative coordinates, use this format:

carto-print aromeu tpl_87c5667f_3eb5_4a19_9300_b39a2d1970d1 30 20 12 " -1.956253,48.711127,2.835159,49.012429" --dpi 300 --img-format CMYK --output-dir /tmp

Library

The previous example calling directly the library would be as follows:

from carto.print import Printer

printer = Printer('aromeu', 'tpl_87c5667f_3eb5_4a19_9300_b39a2d1970d1', 'default_public', 30, 20, 12, '1.956253,48.711127,2.835159,49.012429', 300, 'CMYK')
printer.export('/tmp')

Where the signature of the Printer constructor is as follows:

Printer(CARTO_USER_NAME, MAP_ID, CARTO_API_KEY, WIDTH_CM, HEIGHT_CM, ZOOM_LEVEL, BOUNDING_BOX, DPI, IMAGE_FORMAT)

Where IMAGE_FORMAT is one of RGBA or CMYK

Known Issues

Some exported images may not represent exactly what you see in the map for the given zoom level when you ask for a resolution different than 72DPI. The reason is the static maps API returns images at 72DPI so to achieve a bigger resolution the library requests for bigger images to re-scale.

For this reason, specially labels and point size, line width, may be affected. If that's the case you should be able to "design your map for printing" by increaing the text, points and lines sizes.

Having said that, some of the known issues are:

  • Google Maps basemaps cannot be rendered
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].