Giter Club home page Giter Club logo

printlet's People

Contributors

berndloeber avatar icetan avatar mattiasb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

printlet's Issues

Are polygons supported?

I tried to display polygons and it didn't work with server.js, nor with static.js. Other types of geometry work fine.

My static.js for reference:

var fs = require('fs'),
    printlet = require('../lib/printlet'),
    tileJson = require('./osm.json');

// Create a printlet instance from a TileJSON
printlet(tileJson)({
  // Specify the image options
  width: 800,
  height: 600,
  zoom: 12,
  lng: 11.95,
  lat: 57.7,
  format: 'png',
  // Add the features to be drawn
  geojson: {
    "type": "FeatureCollection",
    "features": [
      {
      "type": "Feature",
      "properties": {},
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [
              11.969261169433594,
              57.71941492162019
            ],
            [
              11.957588195800781,
              57.71588512774503
            ],
            [
              11.95638656616211,
              57.70726548342996
            ],
            [
              11.970462799072266,
              57.70630252339771
            ],
            [
              11.982049942016602,
              57.71368456258319
            ],
            [
              11.978273391723633,
              57.71748962217837
            ],
            [
              11.969261169433594,
              57.71941492162019
            ]
          ]
        ]
      },
        "properties": {
          "style": {
            "strokeStyle": "rgba(700, 0, 0, 1)",
            "lineWidth": "10"
          }
        }      
    },

      // Draw a semi-transparent line
      {
        "type": "Feature",
        "geometry": {
          "type": "LineString",
          "coordinates": [[11.95, 57.7], [12, 58]]
        },
        "properties": {
          "style": {
            "strokeStyle": "rgba(200, 0, 0, 0.6)",
            "lineWidth": "5"
          }
        }
      },
      // Draw a point represented by a text marker
      {
        "type": "Feature",
        "geometry": {
          "type": "Point",
          "coordinates": [11.95, 57.7]
        },
        "properties": {
          "style": {
            "font": "32px serif",
            "fillStyle": "rgb(20, 20, 120)",
            "marker": {
              "text": "Hello World"
            }
          }
        }
      }
    ]
  }
}, function(err, data) {
  if (err != null) throw new Error(err + '\n' + err.stack);
  // Get the image data as a stream and write save it to a file
  data.stream.pipe(fs.createWriteStream('image.png'));
});

I'm using latest version of Printlet.

Settle on a GeoJSON styling standard

At the moment styles for GeoJSON is defined in the properties attribute of a GeoJSON feature as a dictionary called style. The keys under style are the same as the HTML5 canvas API for styling shapes.

I have had a look at GeoJSON CSS and simplestyle and think something like GeoJSON CSS would be a good standard.

Preferably placing the styles dictionary directly under the feature so not to collide with user defined keys under properties.

Also style inheritance might be something to consider, defining a style property in the parent FeatureCollection would set a default style for it's Feature elements.

Add cache for generated images

If I read the server,js correctly, there's currently no caching for generated images. Do you think it would be useful, for example for large Geojson geometries?

Handle incorrect zoom level (and other values)

If I enter incorrect zoom level as part of URL in server.js mode, Printlet is trying to display image for a while, then failing silently. It would be useful, if image useful for debugging was generated instead (with message such as Entered zoom value exceeds maxzoom property defined in your tileJSON file. Please enter correct value and try again

Similar checks would be probably also useful for other properties.

Format text

First, thanks for Printlet, seems very useful. I would like to format rendered text somehow, so it would be possible to use renders in more design-oriented projects.

Add LICENSE file

It's nice to have a LICENSE file to be clear about the terms from early on.

I suggest MIT or BSD, copy it from for example Proj4Leaflet, for example.

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.