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

Invalid index file #6

Open
speg opened this issue Jan 22, 2016 · 3 comments
Open

Invalid index file #6

speg opened this issue Jan 22, 2016 · 3 comments

Comments

@speg
Copy link

speg commented Jan 22, 2016

When running the first example I get the following error. Removing the map.zoomAll(); line allows it to render an image.

I'm not sure if it's the expected output since // expected output: https://github.com/mapnik/node-mapnik-sample-code/blob/master/outputs/map.png is a 404.

node ./render/app.js ./stylesheet.xml map.png
/Users/Steve/Play/mapnik/node-mapnik-sample-code/render/app.js:33
map.renderFileSync(image);
    ^

Error: Invalid index file
    at Error (native)
    at Object.<anonymous> (/Users/Steve/Play/mapnik/node-mapnik-sample-code/render/app.js:33:5)
    at Module._compile (module.js:398:26)
    at Object.Module._extensions..js (module.js:405:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Function.Module.runMain (module.js:430:10)
    at startup (node.js:141:18)
    at node.js:1003:3

mapnik-config --version
3.0.5
node -e "console.log(require('mapnik').version)"
3.4.15

This also happens in the tile examples. When the map.extent = bbox; line is removed it seems to work.

@speg speg changed the title map.ZoomAll breaks first example Invalid index file Jan 22, 2016
@speg
Copy link
Author

speg commented Jan 27, 2016

map.zoomAll is critical to rendering the image so removing it just resulted in a empty image. I found this which lead me to removing the .index file from my data. Now I am able to render the map successfully! Sounds like mapnik should handle the index file though?

@mojodna
Copy link
Member

mojodna commented Feb 4, 2016

@almccon and I recently ran into this too. It appears that somewhere in the mapnik-3.4 series the index file format has changed (we were reproducing it with 3.4.16).

We managed to solve it by using the shapeindex alternative that now ships with node-mapnik: node_modules/.bin/mapnik-shapeindex.js

/cc @springmeyer

@springmeyer
Copy link
Member

I've just removed the index file from this repo to ensure that the same code works with all versions of node-mapnik. Sorry about being slow to help troubleshoot here but @mojodna had the right fix. More details at mapnik/node-mapnik#590

@springmeyer springmeyer reopened this Feb 11, 2016
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

3 participants