0

I have an image that I get from a server, I need to then take that image and tile it on the fly and pass it back to the user. Everything I see keeps using stylesheets which is not what I want/need. Is there a way to do this?

3
  • Your image comes from a webservice? WMS, Geotiff? Others?
    – ThomasG77
    Nov 11, 2015 at 14:24
  • Because if your image is not exotic (special web service), using a tiles server like mapproxy.org (Python) avoid any coding...
    – ThomasG77
    Nov 11, 2015 at 14:35
  • My image comes from an analytics server. I wanted to rasterize the image so that 1) I could load huge images to the map, and 2) the images would translate to 3-d as image layers don't go from OL3-> Cesium Nov 11, 2015 at 15:23

2 Answers 2

1

For your tile question, look at the right place e.g the node-mapnik-sample-code repo

It's working perfectly with

git clone https://github.com/mapnik/node-mapnik-sample-code.git
cd node-mapnik-sample-code
npm install mapnik express generic-pool get
./tile/pool/app.js stylesheet.xml 8000

Then, open http://localhost:8000/1/1/1 to see the result!

You can avoid stylesheets with inline stylesheets... if you look at this sample mentioning

// map with just a style

// eventually the api will support adding styles in javascript

1
  • I really wanted it to create an image pyramid, i.e. slice the tiles up from an image and then serve them as xyz. That doesn't seem doable. Nov 11, 2015 at 14:19
0

At least figured out how to load an image from a buffer,

im = new mapnik.Image.fromBytes(imageFromBuffer)

I can't figure out how to then cut that up into a grid or at least give it an extent so that it doesn't repeat the image. That may not be doable.

Edit: The node-mapnik API is abysmally bad. I have found a TON of functions that are in the code that are 1) very useful and 2) completely undocumented. If you run into problems like I did, get the npm, break open the source, and go through it line by line to figure things out.

EDIT 2: Found the real docs, http://mapnik.org/node-mapnik/documentation/# The API from the github/googling is wrong. https://github.com/mapnik/node-mapnik/tree/master/docs , Don't use that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.