Code Monkey home page Code Monkey logo

avecado's Introduction

  ____  __ __    ___    __   ____  ___     ___
 /    ||  |  |  /  _|  /  | /    ||   \   /   \
|  o  ||  |  | /  |_  /  / |  o  ||    \ |     |
|     ||  |  ||    _|/  /  |     ||     ||     |
|  _  ||  :  ||   |_/   \_ |  _  ||  D  ||  O  |
|  |  | \   / |     \     ||  |  ||     ||     |
|__|__|  \_/  |_____|\____||__|__||_____| \___/

Avecado (pronounced "avecado") is a library for building Mapnik vector tiles, along with language bindings for Python and some utility programs.

Building

Avecado uses the GNU Build System to configure and build itself and requires Mapnik 3.x, the Boost libraries and Python. To install on a Debian or Ubuntu system, please first install the prerequisites:

sudo apt-get install build-essential autoconf automake libtool libboost-all-dev python-dev libprotobuf-dev protobuf-compiler

You will also need to install a 3.x version of the Mapnik library. This version of the library was tested with commit 7ee9745 from Mapnik master.

Then you should be able to bootstrap the build system:

./autogen.sh

You need to increase the maximum vector size to 30 and then run the standard GNU build install:

CPPFLAGS="-DBOOST_MPL_CFG_NO_PREPROCESSED_HEADERS -DBOOST_MPL_LIMIT_VECTOR_SIZE=30" \
./configure && make && make install

Please see ./configure --help for more options on how to control the build process.

There are detailed instructions for CentOS 6 in the docs/ folder.

Using

Avecado has three main executable programs:

avecado, a simple command-line utility for producing vector tiles. Since each invocation loads a Mapnik map, this is not recommended for generating large volumes of vector tiles. However, it can be useful for one-off testing and debugging of datasource definitions.

avecado_server, a very simple HTTP server which serves vector tiles according to the input Mapnik map. The HTTP server is extremely basic and, while it might be useful for ad-hoc testing purposes, is not suitable for production use. It serves tiles in the Google Maps numbering scheme; for example z=2, x=1, y=0 would be available as http://localhost:8080/2/1/0.pbf if the server is run on port 8080. This is explained in more detail on the OpenStreetMap wiki and Google's developer documentation.

scripts/override_xml.py, a utility for altering settings in an XML datasource configuration. This is useful for correcting or overriding any settings which may be different between the output of Mapbox Studio, or your configuration files in version control, and your local or production setups.

Each of these programs takes as input a Mapnik XML file. When used to make vector tiles they do not read the styling information and instead look only at the Map definition, Layers and Datasources. These make up the definition of the vector tile.

Styling information is applied at the time the vector tile is rendered - either on the client, another server, or another instance of a program using Avecado.

Contributing

We welcome contributions to Avecado. If you would like to report an issue, please use the Avecado issue tracker on GitHub.

If you would like to make an improvement to the code, please be aware that Avecado is written mostly in C++11, in the K&R (1TBS variant) with two spaces as indentation. We welcome contributions as pull requests to the repository.

It is possible to build a test coverage report, please see test coverage documentation for details.

avecado's People

Contributors

emka avatar hollinger avatar kevinkreiser avatar pnorman avatar zerebubuth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

avecado's Issues

Is it possible to configure postgis with avecado?

i have installed avecado on ubuntu(12.04) machine and successfully generated the tile.pbf file for sample xml files present in avecado/test directory.

Instread of giving input from Mapnik XML input file, i wants to give from postgis database.

Is it possible, else suggest me some other best way.

List parts of boost needed in readme

With Boost 1.56, it's often needed to build it from source, which is much quicker if only the libraries needed are built. This is difficult to figure out by iterating through building boost and ./configure, because it takes some time and the ./configure error messages are misleading for missing boost libraries.

The libraries currently required are program_options,thread,filesystem,python,regex,system,iostreams,date_time

Got Cross-Origin Request Blocked connecting to avecado server

when i connecting to avecado_server from my server as XMLHttpRequest it shows following message in borwser

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:7789/0/0/0.pbf. This can be fixed by moving the resource to the same domain or enabling CORS.

i know the reason for this was Access-Control-Allow-Method and Access-Control-Allow-Origin Header but i dont know how to enable those in avecado_server.

Use scale internally, not zoom levels

Zoom levels are generally associated with tiling schemes on top of 900913 projections. Although it's possible to build tiling schemes on top of other projections, using zoom levels in the config means that it is more difficult to use avecado for other projections.

Internally, avecado should use scale rather than zoom level, as Mapnik does. It should provide config methods which allow the user to specify either a scale or a zoom level (since the common case is likely to be 900913 still).

Allow izers to be disabled with ./configure

The adminizer will depend on gdal. This isn't a difficult dependency to meet, as basically any server running the rest of a rendering stack will need gdal, but we should add ./configure flags to disable izers.

cannot find Boost libraries, which are are required for building avecado. Please install libboost-dev.

I am using ubuntu12.06. I am executing the configure script as follows

./configure --with-boost-libdir=/usr/local/boost-1.56/lib CXX=g++-4.8 CC=gcc-4.8. But i am getting the following error

configure: We could not detect the boost libraries (version 1.53 or higher). If you have a staged boost library (still not installed) please specify $BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation.
configure: error: cannot find Boost libraries, which are are required for building avecado. Please install libboost-dev.

Larger polygon colour surrounded boundry of a tile.

i'm used mapbox-gl-js client to display vector tile in browser. i use mapbox vector.pbf file it works fine but when i use avecado .pbf file larger polygon coloured like surrounded the each tile.

For example:
Here i have added only ocean polygon
screenshot from 2014-11-18 14 31 34
screenshot from 2014-11-18 14 32 02

Duplicate name in json

{
"center":"-75.6038,40.0799,11",
"maxzoom":"16",
"metatile":"1",
"minzoom":"0",
"name":"MQ Carto Vector",
"maskLevel":0,
"format":"pbf",
"name": "Avecado Development Server",
"private": true,
"scheme": "xyz",
"tilejson": "2.0.0",
"tiles": ["http://localhost:4002/{z}/{x}/{y}.pbf"],
"vector_layers":"...omitted..."
}

There are two "name" entries

How to render vector.pbf file from avecado_server ?

Using command-line(avecado) i can generate vector pbf file.
Now i tried using avecado_server it works fine and showing following lines

./avecado_server test/single_line.xml 7788
Loading mapnik map...
Mapnik map loaded.

But in browser side i didn't know how to retrieve vector pbf file.
I didn't get any information regarding that in avecado.

Bad PostGIS connection

$ ./avecado ~/mq-carto-style-vector/mq-carto-style.tm2source/data.xml 0 0 0
Unable to make vector tile: Postgis Plugin: Bad connection
Connection string: ' dbname=MnPADB connect_timeout=4'
  encountered during parsing of layer 'natearth_ocean_10m' in Layer at line 27 of '/home/pnorman/mq-carto-style-vector/mq-carto-style.tm2source/data.xml'

Also happens without dbname and relying on PGHOST. psql works fine

https://github.com/MapQuest/mq-carto-style-vector/blob/6696477211d1240c0621921c3a7d4237d0a8304d/mq-carto-style.tm2source/data.xml reproduces the problem.

Update mapnik version in README

This version of the library was tested with commit 01c6b422 from Mapnik master.

Commit 01c6b422 does not yet contain mapnik/view_transform.hpp, resulting in a failing build.
Could you please update the commit id to what you are currently using?

Getting error while make avacado

i have cloned avecado today(3-Nov-14)

when i give a command make it shows following error

make all-am
make[1]: Entering directory /home/test/avecado/backup/avecado' CXX src/avecado.lo In file included from src/avecado.cpp:11:0: ./include/backend.hpp:61:3: error: 'backend_pbf' in namespace 'mapnik::vector' does not name a type mapnik::vector::backend_pbf m_pbf; ^ src/avecado.cpp: In function 'std::ostream& avecado::operator<<(std::ostream&, const avecado::tile&)': src/avecado.cpp:17:34: error: invalid use of incomplete type 'struct mapnik::vector::tile' bool write_ok = t.m_mapnik_tile->SerializeToZeroCopyStream(&stream); ^ In file included from ./include/avecado.hpp:4:0, from src/avecado.cpp:1: ./include/tile.hpp:10:46: error: forward declaration of 'struct mapnik::vector::tile' namespace mapnik { namespace vector { struct tile; } } ^ src/avecado.cpp: In function 'bool avecado::make_vector_tile(avecado::tile&, unsigned int, const mapnik::Map&, int, double, unsigned int, unsigned int, unsigned int, const string&, mapnik::scaling_method_e, double, boost::optional<const avecado::post_processor&>)': src/avecado.cpp:40:11: error: 'processor' in namespace 'mapnik::vector' does not name a type typedef mapnik::vector::processor<backend_type> renderer_type; ^ src/avecado.cpp:49:3: error: 'renderer_type' was not declared in this scope renderer_type ren(backend, ^ src/avecado.cpp:49:17: error: expected ';' before 'ren' renderer_type ren(backend, ^ src/avecado.cpp:58:3: error: 'ren' was not declared in this scope ren.apply(scale_denominator); ^ src/avecado.cpp:61:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ make[1]: *** [src/avecado.lo] Error 1 make[1]: Leaving directory/home/test/avecado/backup/avecado'
make: *** [all] Error 2

Fail to build src/make_vector_tile.lo

Trying to build avocado out of the box fails:

On ubuntu 15.04
g++ 4.9.2
Using branch master for avocado
Using branch master for mapnik-vector-tile as git submodule

./configure is successfull
calling 'make' produce the following error:

# make
make  all-am
make[1]: Entering directory '/home/dmarteau/projets/mappy/git-lbs/avecado'
  CXX      src/make_vector_tile.lo
In file included from src/make_vector_tile.cpp:7:0:
mapnik-vector-tile/src/vector_tile_processor.hpp:13:23: fatal error: clipper.hpp: No such file or directory
 #include "clipper.hpp"
                       ^
compilation terminated.
Makefile:1323: recipe for target 'src/make_vector_tile.lo' failed
make[1]: *** [src/make_vector_tile.lo] Error 1
make[1]: Leaving directory '/home/dmarteau/projets/mappy/git-lbs/avecado'
Makefile:807: recipe for target 'all' failed
make: *** [all] Error 2

Include path problem ?

Note that building stand alone mapnik-vector-tile (i.e cd mapnik-vector-tile && make) is succeessfull.

Pass down zoom level to the renderer

As a follow-up to #23 (comment)

All renderers support accept an optional hashmap of key:values (mapnik/mapnik#2553), which are apparently passed down to the postgis plugin.

Do we want to pass down zoom from avecado? It would make SQL queries that are zoom-dependent easier to write, but data styles using those queries would become less compatible (e.g. not work with mapbox-studio)

Core dump when database connection fails with multiple threads

If the database connection fails and --thread-hint is >1 avecado core dumps.

pnorman@pnorman-desktop:~/avecado$ ./avecado_server --thread-hint 4 ~/mq-carto-style-vector/mq-carto-style.tm2source/data.xml 4002
Loading mapnik map...Loading mapnik map...

Loading mapnik map...
Loading mapnik map...
terminate called recursively
terminate called after throwing an instance of 'Aborted (core dumped)
pnorman@pnorman-desktop:~/avecado$ ./avecado_server --thread-hint 1 ~/mq-carto-style-vector/mq-carto-style.tm2source/data.xml 4002
Loading mapnik map...
Exception: Postgis Plugin: Bad connection
Connection string: ' connect_timeout=4'
  encountered during parsing of layer 'water' in Layer at line 26 of '/home/pnorman/mq-carto-style-vector/mq-carto-style.tm2source/data.xml'

Fixing the database parameters fixes both 1 and 4 threads.

How to avoid overlapping geometries in Avecado ?

On going with this #23
i have found some geometries(lines) are overlapped.
Example take Admin boundaries

Correct taken from mapbox
correct_overlapped

Admin_level = 2 two lines overlapped
multiline_error

Admin_level = 2, 3 and 4 are overlapped
error_with_stateboundary

i dont want this overlapping, instead i just show the higher admin_level line. Is it possible to control in avecado ?

Return tilejson

The data.xml for Mapnik includes information for returning a tilejson

That JSON fragment doesn't include all the information needed for a tilejson, but other parameters provide the name, min/max zoom, center. The required "tiles" key may need another command line option, since that varies depending on the hostname, and if you are accessing it remotely, localhost doesn't work.

To-do:

  • Can we get the parameters from Mapnik, or do we parse the XML ourselves?

mapbox/tilejson-spec#14 has some examples of the format, since it's not formally documented

Add submodule to build docs and process

See #36 for background.

The build docs should mention git submodules, and show how to init and update them before the build.

The build process should check for the presence of these files at configure-time and give a sensible error message.

libcurl configure

Running

./configure --prefix=$HOME/avecado --with-boost=$HOME/boost \
--with-mapnik-config=$HOME/mapnik/bin/mapnik-config

I get the error

configure: error: Package requirements (libcurl >= 7.30) were not met:

No package 'libcurl' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables LIBCURL_CFLAGS
and LIBCURL_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

pkg-config wasn't picking up libcurl, so I tried LIBCURL_LIBS="-L/usr/lib/x86_64-linux-gnu -lcurl" andLIBCURL_CFLAGS=curl-config --cflags LIBCURL_LIBS=curl-config --libs``, neither worked.

Tilejson integers

The tilejson specification says that min and max zoom are integers but the json produced has strings

maxzoom":"16",
"metatile":"1",
"minzoom":"0",

This appears to be an issue for minzoom, maxzoom, center, and perhaps bounds. I wouldn't be surprised if metatile was also expected to be an integer.

How to Content-Encoding in Avecado?

Generating .pbf file size is higher in size and it kills my bandwidth. so based on request header i need to set Content-Encoding : gzip in response and gzip tile.get_data() in rep.content.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.