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

Help with mapnik plugin #22

Open
carrbrpoa opened this issue Oct 10, 2017 · 7 comments
Open

Help with mapnik plugin #22

carrbrpoa opened this issue Oct 10, 2017 · 7 comments

Comments

@carrbrpoa
Copy link

carrbrpoa commented Oct 10, 2017

Hello!

I just installed tilestrata and am trying to use it to render maps where it's data comes from Postgis and it's style comes from mapnik XML (generated by Carto in another solution test - by the way, I'm trying to replace gopnik of that solution for tilestrata, because I know node.js better).

So the server is up (with some warnings), /health is Ok ({"ok":true,"version":"2.1.0","host":"osboxes","uptime":"15 minutes, 20.149 seconds","uptime_s":920.15}) but when I put together a Leaflet application to try the maps generated, it just gives me NOT FOUNDS (404):

1.png:1 GET http://localhost:9999/basemap/2/0/1.png 404 (Not Found)
3.png:1 GET http://localhost:9999/basemap/2/0/3.png 404 (Not Found)
3.png:1 GET http://localhost:9999/basemap/2/1/3.png 404 (Not Found)
1.png:1 GET http://localhost:9999/basemap/2/1/1.png 404 (Not Found)
9625.png:1 GET http://localhost:9999/basemap/14/5859/9625.png 404 (Not Found)
9625.png:1 GET http://localhost:9999/basemap/14/5863/9625.png 404 (Not Found)
9625.png:1 GET http://localhost:9999/basemap/14/5864/9625.png 404 (Not Found)
9625.png:1 GET http://localhost:9999/basemap/14/5857/9625.png 404 (Not Found)

and so on. My tilestrata server code:

var tilestrata = require('tilestrata');
var disk = require('tilestrata-disk');
var sharp = require('tilestrata-sharp');
var mapnik = require('tilestrata-mapnik');
var dependency = require('tilestrata-dependency');
var strata = tilestrata();

// define layers
strata.layer('basemap')
    .route('*@2x.png')
        .use(disk.cache({dir: '/var/lib/tiles/basemap'}))
        .use(mapnik({
            pathname: '/home/osboxes/dados_container_renderer/stylesheet_localhost_pg.xml',
            tileSize: 512,
            scale: 2
        }))
    .route('*.png')
        .use(disk.cache({dir: '/var/lib/tiles/basemap'}))
        .use(dependency('basemap', '[email protected]'))
        .use(sharp(function(image, sharp) {
            return image.resize(256);
        }));

// start accepting requests
strata.listen(9999);

It seems that it's not even scratching server, since no terminal entries are being generated.
Am I missing something?

Thanks a lot!

@brianreavis
Copy link
Member

.use(dependency('basemap', '[email protected]'))

This line should be: .use(dependency('basemap', '*@2x.png')). Hope this helps!

@carrbrpoa
Copy link
Author

carrbrpoa commented Oct 10, 2017

It does, @brianreavis, thanks! 💯

After that, I observed that the path designated for storing cache contains only some few png for zoom level 14 (I guess), but I already zoomed and panned the map a lot. Any ideas about that?

@brianreavis
Copy link
Member

I'm not sure this will fix what you are experiencing, but could you update tilestrata-dependency to 0.5.1? Just noticed it wasn't quite set up to handle the relatively-new filenameless routes (which could lead to some weird behavior).

@carrbrpoa
Copy link
Author

It worked @brianreavis, thanks a lot!

One last thing (:P): when I try /profile, server stops with:

/home/osboxes/tilestrata/node_modules/tilestrata/lib/TileServer.js:340
				plugin_name: getplugin(plugin, layer, file).plugin.name || '',
				                                           ^

TypeError: Cannot read property 'plugin' of undefined
    at /home/osboxes/tilestrata/node_modules/tilestrata/lib/TileServer.js:340:48
    at Array.forEach (native)
    at TileServer.getProfileData (/home/osboxes/tilestrata/node_modules/tilestrata/lib/TileServer.js:330:7)
    at module.exports (/home/osboxes/tilestrata/node_modules/tilestrata/lib/routes/profile.js:23:20)
    at TileServer._handleRequest (/home/osboxes/tilestrata/node_modules/tilestrata/lib/TileServer.js:131:10)
    at Server.<anonymous> (/home/osboxes/tilestrata/node_modules/tilestrata/lib/TileServer.js:532:8)
    at emitTwo (events.js:106:13)
    at Server.emit (events.js:191:7)
    at HTTPParser.parserOnIncoming [as onIncoming] (_http_server.js:548:12)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:99:23)

Do I need to do something? Thought it should come by default.

Thanks again!

@brianreavis
Copy link
Member

Hah, embarrassing. Good catch! Just released a patch for that: https://github.com/naturalatlas/tilestrata/releases/tag/v2.1.2

@carrbrpoa
Copy link
Author

That's it, thanks for your work, @brianreavis, it's really nice!

When I try return image.resize(256).quality(80).webp();, as seen in sample I get error 500. How can I figure out why? Only with return image.resize(256); it works.

@carrbrpoa
Copy link
Author

@brianreavis There are any logging available?

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

2 participants