Git Product home page Git Product logo

mapnik-reference's Introduction

mapnik-reference

mapnik-reference is a spec of what Mapnik styling and datasource properties are supported for each version.

It is useful for building parsers, tests, compilers, and syntax highlighting/checking for languages.

Build Status

Default branch is gh-pages which is displayed at http://mapnik.org/mapnik-reference

Versioning

The version of this repository indicates the schema of the reference.json file. Schema changes of any type are expected to change the implementation requirements of a parser, so they will increment the major version of this repository in semver style.

The directories in this repository directly correspond to released versions of Mapnik and the next targeted release of Mapnik.

Meaning

The structure of the file is as such:

  • version: the version of Mapnik targeted. Same as the containing directory.
  • style: properties of the Style XML element
  • layer: properties of the Layer XML element
  • symbolizers/*: properties that apply to all symbolizers
  • symbolizers/symbolizer: properties that apply to each type of symbolizer
  • colors: named colors supported by Mapnik. see include/mapnik/css_color_grammar.hpp

Property stability

The status key may be used to define the stability of a property. When the key is not specified, then the status is stable. Possible values are:

  • stable: property is here to stay and its behavior is not anticipated to change
  • unstable: property is here to stay but its behavior/meaning of property may change
  • deprecated: property should not be used and will be removed in upcoming major version of Mapnik
  • experimental: property should not be used and may change, be re-named, or disappear at any time

Using

This is a valid npm module and therefore can easily be used with node.js.

npm install mapnik-reference

Install it as a dependency of your application. Then use that API to get a reference instance for a specific version of Mapnik:

var mapnik_reference = require('mapnik-reference');
var ref = mapnik_reference.load('3.0.0');

You can also get access to an array of all known versions:

var mapnik_reference = require('mapnik-reference');
mapnik_reference.versions;
[ '2.0.0',
  '2.0.1',
  '2.0.2',
  '2.1.0',
  '2.1.1',
  '2.2.0',
  '2.3.0',
  '3.0.0' ]

Other implementations will want to simply copy the JSON file from the desired implementation, like 2.0.1/reference.json.

The file can then be parsed with any of the many json parsers.

Testing

Tests require python and node.js:

make test

Users

  • carto.js
  • Mapnik itself (the util/validate-mapnik-instance.py is used to check binding consistency like in #1427)

mapnik-reference's People

Contributors

1ec5 avatar ajashton avatar artemp avatar davenquinn avatar flippmoke avatar florianf avatar gravitystorm avatar hollinger avatar incanus avatar kkaefer avatar matkoniecz avatar migurski avatar misterboo avatar mojodna avatar mstock avatar nebulon42 avatar pnorman avatar rundel avatar samanpwbb avatar sk1p avatar sommerluk avatar springmeyer avatar stevage avatar talaj avatar thomasg77 avatar tmcw avatar tofferrosen avatar yhahn avatar yohanboniface avatar

Stargazers

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

Watchers

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

mapnik-reference's Issues

Full reference of datasource plugin options

See mapbox/tilemill#994 for more details.

Seems critical for this file to be built from templates since many datasources share parameters and using a template will reduce duplication.

Currently the template can be built into a standalone doc like:

node util/make-datasource-ref.js latest/datasources.template

Columns order for autogenerated doc

Hello,

I've started to work on using reference.json as a file to autogenerate symbolizers reference for mapnik.
See a first result on https://github.com/ThomasG77/mapnik-symbolizers-autodoc/wiki/
As you will see, the columns order is wrong because we don't have a predefined order for them.

So, we need to defined the global order of the columns to get a table with important columns in first. We maybe need to hide some columns because they are not very important.
You will see below an unordered list. Help us to choose the best order and the hidden columns.

[parameters,
'api',
'availability',
'css',
'default',
'default-meaning',
'default-value',
'doc',
'range',
'required',
'serialization',
'type',
'validate']

Any comments is welcome.
Some columns may be removed or change e.g previous ticket

Better descriptions

These parameters could use friendlier descriptions:
line-join
line-cap
*-gamma-method
*-simplify-algorithm
*-rasterizer
line-pattern-simplify-algorithm
text-placement
text-placement-type
text-placements
shield-placement
shield-placement-type
shield-placements

License?

There doesn't seem to be any indication of what license this is under, either in the package.json metadata or in the README.md, nor is there a separate license file...

text-line-spacing takes negative value

A negative integer is valid and can be useful for the text-line-spacing property to allow wrapped text lines to be less far apart than the default.

But currently the reference reports it as unsigned which is incorrect.

composite-operation -> comp-op?

The SVG spec uses comp-op which is why Mapnik went with this naming, whereas we usually we tend to spell out words fully to avoid abbreviations.

So, the open question is: is there a good reason to call this composite-operation in CSS, or should we switch to comp-op before all this goes live in a TileMill release?

default and default-value, the same?

Like for docs and doc, it seems duplicated.
Choose one depending on impacts on others tools.
For info, "default-value" is most of the time the prefered keyword (compare to "default" ) in reference.json.

A sample below :L 347-358

    "avoid-edges": {
        "css": "shield-avoid-edges",
        "doc": "Tell positioning algorithm to avoid labeling near intersection edges.",
        "type": "boolean",
        "default": false
    },
    "minimum-distance": {
        "css": "shield-min-distance",
        "type": "float",
        "default-value": 0,
        "doc": "Minimum distance to the next shield symbol, not necessarily the same shield."
    },

Expose raster-filter-factor

Would be great to have raster-filter-factor exposed to further refine the sampling for rasters in TileMill.

Do not force multithreaded build

GNU Make has a -j switch to specify how many threads to use for building. This is hard-coded in mapnik-reference's Makefile to match the number of cores on the machine.

It is annoying because using all cores makes the machine unresponsive so you can't do anything else, and there's no switch to disable that. Dunno what's the best way to deal with this

Reference for 2.0.0 is missing

Unfortunately if X.Y versioning can't be supported (see #29) there's no way to make things work automatically without providing a reference file for each and every version...

Could you add one for 2.0.0 ?

Add 2.2.0 reference

Latest reference is currently 2.1.1 (beside "latest"). Since 2.2.0 is out a named reference for it is due.

Enabling new Mapnik expressions

The Mapnik expr-v2 branch has a new framework to make it very easy to move most symbolizer properties to expressions. This branch will soon be merged to Mapnik master and released as Mapnik 3.0.0.

Already most properties that express color fills stroke widths and opacity have become expressions in this Mapnik branch. This ticket stands to track which are newly expressions and which have been enabled here in the reference.json. For these new expressions to be available in TileMill they need to be added reference.json

I've done this for some in:

28cc754

TODO:

  • - evaluate which other properties should become expressions in Mapnik
  • - ensure they are listed as "expression" type in the latest reference.json

Choose beetween "docs" or "doc", not both

In reference.json file, some keys in the keys of symbolizers are "doc" and "docs" and seems to describe the same thing.
Choose a convention or don't change if the two keywords really don't have the same meaning.

Ilustrated examples extract from:

L 292-296

    "spacing": {
        "css": "marker-spacing",
        "docs": "Space between repeated labels",
        "type": "float"
    },

Line 385-392

    "halo-fill": {
        "css": "shield-halo-fill",
        "docs": "Color of the text halo",
        "type": "color",
        "default-value": "#FFFFFF",
        "default-meaning": "white",
        "doc": "Specifies the color of the halo around the text."
    },

I don't know impact on other applications depending of this file.

make check fails with node-0.8.4

  โœ– 7 of 84 tests failed:

  1) mapnik.Datasource should validate with known shapefile:

  AssertionError: "unknown" deepEqual "polygon"
      at Context.options.type (/home/src/cartodb/node-mapnik/test/datasource.test.js:81:16)

  2) mapnik.Datasource should validate with known geojson:

  AssertionError: "unknown" deepEqual "polygon"
      at Context.<anonymous> (/home/src/cartodb/node-mapnik/test/datasource.test.js:143:16)

  3) mapnik.Parameters  should be accessible from map:

  AssertionError: "undefined" == 0.999
      at Context.<anonymous> (/home/src/cartodb/node-mapnik/test/parameters.test.js:12:16)

  4) mapnik.Parameters  should be settable on map: 

  AssertionError: "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Map srs=\"+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs\"/>\n" == "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Map srs=\"+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs\">\n    <Parameters>\n 
      at Context.<anonymous> (/home/src/cartodb/node-mapnik/test/parameters.test.js:21:16)

...

I omitted part of the test results.

Note that I built and checked with LD_LIBRARY_PATH=/extra/mapnik-2.1.0/lib/ PATH=/extra/mapnik-2.1.0/include/:$PATH

make test fails to find mocha

The Makefile expects to find node_modules/mocha/bin/mocha but package.json doesn't list mocha in the devDependencies.

shield-dx and dy docs

mapbox/carto#359


The docs state

shield-text-dy

Default Value: 0 Displace text within shield by fixed amount, in pixels, +/- along the Y axis. A positive value will shift the text down

shield-dy

Default Value: 0 Displace shield by fixed amount, in pixels, +/- along the Y axis. A positive value will shift the text down

Do both shift the text down, or does one shift the shield down?

I'd do a PR to fix it, but I'm not positive what all the alignment stuff does here.

consider auto-generation of DTD

A DTD was added to mapnik/utils/xml after mapnik/mapnik#684, but it has not been updated. I just don't have the bandwidth to keep it up to date when focusing on mapnik-reference and the codebase instead.

Therefore it was removed before Mapnik 2.1 release.

We should consider auto-generating it using the reference, and providing scripts here.

/cc @manelclos.

marker-type:arrow in 2.0.1 reference, is that correct ?

Using marker-type:arrow with 2.0.0 is failing for me.
I do see it listed in the reference for 2.0.1 (reference for 2.0.0 is missing, see #35) but git log seems to say the support was added on July, 10 2012 (3e895ac6b7205d4490501ce66f83c2ae178fbca3).

So is arrow supposed to work with 2.0.1 and 2.0.2 or should the reference be fixed ?

Better naming than 'tags'

The raster-colorizer type is currently tags - not sure if this really makes sense - sure, it's tags, but lots of other things, like text placements, will be tags as well, and should have type checking so that you can't specify color stops as text placements and so on.

Types are also usually named by carto input rather than serialization.

Thinking a better name might be stops?

/cc @springmeyer

Support X.Y versions

I'm researching about the possibility to specify a target version to go along carto documents to ensure their interpretation won't change over time. In doing this I found that mapnik-reference looks like trying to serve a similar need.

What I don't understand, though, is why mapnik-reference provides versions up to the patch level.
Does mapnik itself changes the language between patch level releases ?

I would expect to be able to reference "2.0" or "2.1" without the need to go as deep as "2.0.1".

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.