Git Product home page Git Product logo

pymapnik2's Issues

Can't install mapnik2 via pip install

I can't load mapnik2 from pip.
I get the following error.

ERROR: Complete output from command python setup.py egg_info:
    ERROR: Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-snc_7_7f/mapnik2/setup.py", line 10
        exec open('src/mapnik/utils.py').read() in mapnik_utils
                ^
    SyntaxError: invalid syntax

Anyone with this problem?

Get buffer from mapnik.Image

mapnik.Image has a save() method which can be used to save an image to a given filename, for example, the following will save the image to a file called tmp.png in the png256 format:

im = mapnik.Image(255,267)
im.background = mapnik.Color('rgba(1,2,3,.5)')
im.save('tmp.png', 'png256')

When one wants to use the data from the image (variable im in the upper example), one has to open the just-saved file and read the data.

Is it possible to save the image in a given format to an in-memory buffer? I noticed that the mapnik.Image wrapper does have the tostring() method, but this returns a string encoded in some sort of a hex format. I'm sure this can be decoded, but it would be easier to directory save the image to a buffer.

I'm unfamiliar with the mapnik internals, but if wanted, I can investigate and probably provide a patch for pymapnik2 to support this.

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.