{"id":20234880,"url":"https://github.com/datamade/lascaux","last_synced_at":"2025-04-10T18:51:36.937Z","repository":{"id":18080413,"uuid":"21143779","full_name":"datamade/lascaux","owner":"datamade","description":":globe_with_meridians: Web API for printing high resolution PDF maps","archived":false,"fork":false,"pushed_at":"2018-03-16T20:38:57.000Z","size":6738,"stargazers_count":17,"open_issues_count":3,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-24T16:38:13.531Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://lascaux.datamade.us/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/datamade.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-06-23T22:02:34.000Z","updated_at":"2023-09-03T23:54:40.000Z","dependencies_parsed_at":"2022-07-26T21:01:59.630Z","dependency_job_id":null,"html_url":"https://github.com/datamade/lascaux","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datamade%2Flascaux","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datamade%2Flascaux/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datamade%2Flascaux/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datamade%2Flascaux/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/datamade","download_url":"https://codeload.github.com/datamade/lascaux/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248274139,"owners_count":21076314,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T08:13:30.600Z","updated_at":"2025-04-10T18:51:36.916Z","avatar_url":"https://github.com/datamade.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Lascaux\n\nWeb API for printing high resolution PDF maps.\n\n### Usage\nLascaux works by passing in a link to a set of [map tiles](https://www.mapbox.com/foundations/how-web-maps-work/) (similar to how [Leaflet](http://leafletjs.com/) loads in [TileLayers](http://leafletjs.com/reference.html#tilelayer)) and returning a high resolution PDF for printing. You can also set the map center, zoom level and size of your desired PDF.\n\nParameters:\n* `center` - Latitude,longitude of map center\n* `dimensions` - Height,width of desired map in pixels. Defaults to *1275,1650* (8.5\" x 11\" letter size). Another useful size is *2550,3300* (11\" x 17\" tabloid size)\n* `zoom` - Number indicating the zoom level from 1 (the whole world) to 20 (a city block). Defaults to 17.\n\nOptional parameters:\n* `overlay_tiles` - Your map data tile layer in this format: `http://{s}.somedomain.com/blabla/{z}/{x}/{y}.png`. *these tiles should support transparency*\n* `base_tiles` By default, we use tiles from [Open Street Map](http://www.openstreetmap.org/#map=13/41.8846/-87.6822). If you want to provide your own, however, you can do so by providing an encoded URL to your own tile layer. Expects the same format as `overlay_tiles`\n\nWe use Open Street Map tiles because they show building addresses for zoom 17 and above. Here's what they look like:\n\n![Open Street Map](https://raw.githubusercontent.com/datamade/lascaux/master/static/images/openstreetmap-tiles.png)\n\nHere's some other `base_tiles` that are good for printing:\n\n[MapBox streets](https://a.tiles.mapbox.com/v4/datamade.hnmob3j3/page.html?access_token=pk.eyJ1IjoiZGF0YW1hZGUiLCJhIjoiaXhhVGNrayJ9.0yaccougI3vSAnrKaB00vA#3/0.00/0.00) \n\n`https://{s}.tiles.mapbox.com/v3/datamade.hn83a654/{z}/{x}/{y}.png`\n\n![Mapbox streets](https://raw.githubusercontent.com/datamade/lascaux/master/static/images/mapbox-streets-tiles.png)\n\n[Toner, by Stamen](http://maps.stamen.com/#toner/12/37.7706/-122.3782) \n\n`http://d.tile.stamen.com/toner/{z}/{x}/{y}.png`\n\n![Toner, by Stamen](https://raw.githubusercontent.com/datamade/lascaux/master/static/images/stamen-toner-tiles.png)\n\n[Terrain, by Stamen](http://maps.stamen.com/#terrain/12/37.7706/-122.3782) \n\n`http://c.tile.stamen.com/terrain/{z}/{x}/{y}.jpg`\n\n![Terrain, by Stamen](https://raw.githubusercontent.com/datamade/lascaux/master/static/images/stamen-terrain-tiles.png)\n\n[Satellite by MapBox](https://a.tiles.mapbox.com/v4/datamade.k92mcmc8/page.html?access_token=pk.eyJ1IjoiZGF0YW1hZGUiLCJhIjoiaXhhVGNrayJ9.0yaccougI3vSAnrKaB00vA#3/44.47/-100.81) \n\n`http://a.tiles.mapbox.com/v3/datamade.k92mcmc8/{z}/{x}/{y}.png`\n\n![Satellite by MapBox](https://raw.githubusercontent.com/datamade/lascaux/master/static/images/mapbox-satellite-tiles.png)\n\n#### Basic example\nHere's an 11\" x 17\" map of vacant properties around S 55th and W California on Chicago's South Side provided by [LocalData](http://localdata.com/) and [Southwest Organizing Project](http://www.swopchicago.org):\n\nhttp://lascaux.datamade.us/api?center=-87.69358,41.786456\u0026dimensions=2550,3300\u0026zoom=17\u0026overlay_tiles=http://localdata-tiles.herokuapp.com/06a311f0-4b1a-11e3-aca4-1bb74719513f/filter/Is-property-vacant/Yes/tiles/{z}/{x}/{y}.png\n\n[![lascaux demo](https://raw.githubusercontent.com/datamade/lascaux/master/static/images/lascaux-demo.png)](http://lascaux.datamade.us/api?center=-87.69358,41.786456\u0026dimensions=2550,3300\u0026zoom=17\u0026overlay_tiles=http://localdata-tiles.herokuapp.com/06a311f0-4b1a-11e3-aca4-1bb74719513f/filter/Is-property-vacant/Yes/tiles/{z}/{x}/{y}.png)\n\n#### Custom `base_tiles` example\nYou can pass in your own `base_tiles` if you don't like ours. Here's the same LocalData map with [Stamen's Toner base tiles](http://maps.stamen.com/toner/#12/37.7706/-122.3782):\n\nhttp://lascaux.datamade.us/api?center=-87.69358,41.786456\u0026dimensions=2550,3300\u0026zoom=17\u0026overlay_tiles=http://localdata-tiles.herokuapp.com/06a311f0-4b1a-11e3-aca4-1bb74719513f/filter/Is-property-vacant/Yes/tiles/{z}/{x}/{y}.png\u0026base_tiles=http://d.tile.stamen.com/toner/{z}/{x}/{y}.png\n\n[![Stamen Toner tiles](https://raw.githubusercontent.com/datamade/lascaux/master/static/images/stamen-base.png)](http://lascaux.datamade.us/api?center=-87.69358,41.786456\u0026dimensions=2550,3300\u0026zoom=17\u0026overlay_tiles=http://localdata-tiles.herokuapp.com/06a311f0-4b1a-11e3-aca4-1bb74719513f/filter/Is-property-vacant/Yes/tiles/{z}/{x}/{y}.png\u0026base_tiles=http://d.tile.stamen.com/toner/{z}/{x}/{y}.png)\n\n### Making a request in python\n\n``` python\n\u003e\u003e\u003e import requests\n\u003e\u003e\u003e params = {\n              'center': [-87.69358, 41.786456],\n              'dimensions': [2550, 3300], # tabloid size\n              'zoom': 17,\n              'overlay_tiles': 'http://localdata-tiles.herokuapp.com/06a311f0-4b1a-11e3-aca4-1bb74719513f/filter/Is-property-vacant/Yes/tiles/{z}/{x}/{y}.png'\n            }\n\u003e\u003e\u003e r = requests.get('http://lascaux.datamade.us', params=params)\n\u003e\u003e\u003e with open('my_map.pdf', 'wb') as f:\n        f.write(r.content)\n```\n\nThat should give you a file called ``my_map.pdf`` in your current working directory\n\n### Installation\n\n**Setting up Python and OpenCV**\n\nThis is by far the biggest hassle. Once it is done, however, it never needs to\nbe done again. These instructions work on Ubuntu 12.04. You’ll probably need to\nmodify them to suit your particular environment. These directions also assume\nyou have [virtualenvwrapper](http://virtualenvwrapper.readthedocs.org/en/latest/)\nsetup as well.\n\n```bash\n$ mkvirtualenv printmatic\n$ pip install numpy\n$ sudo apt-get install cmake libgtk2.0-dev pkg-config libavcodec-dev \\\n  libavformat-dev libswscale-dev libamd2.2.0 libblas3gf libc6 libgcc1 \\\n  libgfortran3 liblapack3gf libumfpack5.4.0 libstdc++6 build-essential \\\n  gfortran libatlas-dev libatlas-base-dev libblas-dev liblapack-dev libjpeg-dev \\\n  libpng-dev libtiff-dev libjasper-dev\n$ wget -O opencv-2.4.9.zip http://downloads.sourceforge.net/project/opencvlibrary/opencv-unix/2.4.9/opencv-2.4.9.zip?r=http%3A%2F%2Fopencv.org%2Fdownloads.html\u0026ts=1403558615\u0026use_mirror=softlayer-dal\n$ mkdir src \u0026\u0026 mv opencv-2.4.9.zip src \u0026\u0026 cd src\n$ unzip opencv-2.4.9.zip\n$ cd opencv-2.4.5/\n$ mkdir release\n$ cd release\n$ cmake -DMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=$VIRTUAL_ENV/local/ \\\n  -DPYTHON_EXECUTABLE=$VIRTUAL_ENV/bin/python \\\n  -DPYTHON_PACKAGES_PATH=$VIRTUAL_ENV/lib/python2.7/site-packages \\\n  -DINSTALL_PYTHON_EXAMPLES=ON ..\n$ make -j8 # Set the number here to the number of processing cores you have\n$ make install\n```\n\n### Mac install\n\n#### Make a virtual environment\n\n    $ mkvirtualenv printmatic\n\n#### Install the required libraries\n\n    $ pip install -r requirements.txt\n\n#### Install OpenCV\n\nThis is a hassle. Maybe use brew?\n\nI already had OpenCV installed, and had to copy `cv2.so` to my virtualenv's\n`site-packages`. This probably can be dealt with better by some `PATH`\nmanuvering.\n\n#### Install Cairo\n\nGetting Cairo set up has been a major pain. The most common problems are caused\nby it simply not being found. Try:\n\n    export PKG_CONFIG_PATH=/usr/X11/lib/pkgconfig\n\n(or just add it right to your `PATH`)\n\nOn Ubuntu you should be able to get libcairo and the appropriate header files thusly:\n\n```bash \n$ sudo apt-get install libcairo2-dev\n```\n\n### Running the app\n\n    $ python app.py\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatamade%2Flascaux","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdatamade%2Flascaux","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatamade%2Flascaux/lists"}