Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot load from vectortile source in XML #108

Closed
amandasaurus opened this issue Mar 28, 2017 · 1 comment
Closed

Cannot load from vectortile source in XML #108

amandasaurus opened this issue Mar 28, 2017 · 1 comment

Comments

@amandasaurus
Copy link

I have a mapnik XML file which references a vectortile source, but it doesn't load any vector tiles.

You can see a demo of this by checking out the mapnik-source branch of the osm-carto-vector-tiles repo, and run make tessera. This will start a tessera server on http://localhost:8080/tiles/, and the entire map will be the blue colour of the map background, with no data. Rather than an OSM carto map. (You need a osm2pgsql imported DB in gis). tessera's http server prints to the console, and there's no record of it trying to access the tilejson index.js, nor any pbf vector tiles.

The <Parameters> of the XML file look like this:

<Parameters>
  <Parameter name="bounds">-180,-85.05112877980659,180,85.05112877980659</Parameter>
  <Parameter name="center">0,0,4</Parameter>
  <Parameter name="description"><![CDATA[A general-purpose OpenStreetMap mapnik style, in CartoCSS]]></Parameter>
  <Parameter name="format">png</Parameter>
  <Parameter name="maxzoom">22</Parameter>
  <Parameter name="metatile">2</Parameter>
  <Parameter name="minzoom">0</Parameter>
  <Parameter name="name"><![CDATA[OpenStreetMap Carto]]></Parameter>
  <Parameter name="scale">1</Parameter>
  <Parameter name="source"><![CDATA[tilejson+http://localhost:8080/pbfs/live/index.json]]></Parameter>
</Parameters>

The same style works as a tmstyle (that's the master branch of that repo), however osm-carto is complex, and some changes to support vectortiles cause carto to take 4 minutes to parse this file (cf. carto issue #470), and when using tmstyle this parsing occurs every time when starting the server. If I could use Mapnik XML, then I don't have to reparse the cartocss file every time, meaning a massive performance gain for me.

I thought that tilelive might not be loading things correctly, but I get the same outcome when I use this command: MAPNIK_FONT_PATH=$(find /usr/share/fonts/ -type f | sed 's|/[^/]*$||' | uniq | paste -s -d: -) ./node_modules/.bin/tessera -r tilelive-tilejson -r tilelive-vector -r tilejson -c tessera-serve-vector-tiles.json. But that's just a guess.

The pbf/tmsource endpoint works fine. If you run this command in another window MAPNIK_FONT_PATH=$(find /usr/share/fonts/ -type f | sed 's|/[^/]*$||' | uniq | paste -s -d: -) ./node_modules/.bin/tessera -p 8081 tmstyle://./osm-carto.tm2/ the map will correctly appear on http://localhost:8081/, and that uses the 8080 pbf source which the XML should be using.

I have hacked tilelive-tmstyle to print out the XML that carto renders (just before here), and it looks the same as what I have, with the same source and <Parameters>, which is what led me to think this raw XML would work. Is loading from vectortiles supported in tilelive-mapnik? Is there something obvious I'm missing? Is the source in the <Parameters> correct?

@amandasaurus
Copy link
Author

Turns out I am using it wrong. If you use tilelive-vector, i.e. vector:, instead of mapnik:, then it does exactly this (Mapnik XML with vector tiles).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant