span8
span4
span8
span4
After adding MapTextLabeller in 2013,we made another step for making beautiful maps with FME.FME 2014 can produce high quality raster maps with a new transformer called MapnikRasterizer,which is based on Mapnik,a Free Toolkit for developing mapping applications.Unlike Mapnik itself,our transformer does not require any programming skills,and works just like any other Workbench transformer through setting parameters in the familiar environment,sending features to it through input ports and getting a raster through the output port.
In previous years,making a raster map with FME required a lot of transformers - ColorSetters,AttributeCreators,Sorters,and often many others.For example,a map on the picture above required Bufferer for making polygons from street centerlines,and Dissolver for making block outlines.Now most of these transformers can be replaced with a single MapnikRasterizer transformer.One geometry can be stylized in many ways.For example,just one polygon entering the transformer can become a line or a polygon,it can be shown with a linear or area pattern,replaced with a text or a symbol - all in one transformer,from one feature and one input port.We can say (Using "Dr Who" reference) that MapnikRasterizer is "bigger on the inside than the outside".
MapnikRasterizer belongs to a special kind of transformers,among which are also InlineQuerier and MapTextLabeller - these transformers have dynamic input ports.Before FME 2014,it was a bit confusing - a newly added transformer of this kind had no input ports at all - they had to be added through parameters.We made it more intuitive and simple this year - now we can simply drag a connector from a reader or another transformer to the special "Connect Input" port and this generates the new input port:
Within the "Parameters" dialog,MapnikRasterizer has five sections.The "Transformer" section is a standard one:
Four others contain parameters specific to MapnikRasterizer,but some of them are similar to other rasterizers (e.g.ImageRasterizer).
"Raster properties" define the number of rows and columns or cell size,as well as interpretation (RGB24 or RGBA32 only).Unlike ImageRasterizer,MapnikRasterizer does not allow cells with different sizes along x and y.
"Background",which is a collapsible section (another new feature in FME 2014),allows setting color,transparency and a background image:
When the background image is specified,color and transparency are ignored.
"Ground Extents" allows setting the extents of the output raster if the extents of the features aren't sufficient.
Specifying ground extents can be quite useful - the extents are defined by the input features,which have no styling information - for example,they have no width.So,if a line feature defines the edge of the image,and its width is set to,say,8 pixels,the output raster will show only a half of this width,that is,the line on the edge will be only 4 pixels wide.In this case,it is necessary to add some margins to the real extents of the data.Compare two rasters below - the extents of the left raster are defined by the input line,the image on the right has user-specified extents:
An easy way to add user-defined extents is to make a common bounding box for all the features (BoundingBoxAccumulator) and buffer it (Bufferer).Then,this feature should go into the MapnikRasterizer as a line or a polygon,where its symbology should be set to full transparency.Or,we can extract the min/max coordinates of this feature into attributes (BoundsExtractor),log them (Logger),and use the values in the "Ground Extents" section.
All the Mapnik magic is happening in the "Inputs" section.Here we define how features will look on the output raster.Each input port can have one or more layers associated with it.The look of each layer is defined by its Symbolizer.Mapnik has 10 kinds of symbolizers:
Let's take a single polygonal feature and try rasterizing it using only two basic symbolizers - Line and Polygon.The illustration below shows the transformer with just a single input port ("Finland"),and a single feature entering the transformer.Within "MapnikRasterizer Parameters" dialog we add two layers - one for styling the feature as a polygon,and another - for styling it as a line.One more dialog "Line Parameters"shows how the actual symbology for the boundary is defined.Behind the scenes we set our background to cyan,and set cell size to 2500:
The output is a simple raster:
Now we add more symbolizers.
On top of the yellow boundary we can add a pattern that is often used for showing state boundaries,the interior of the polygon can be filled with a photographic texture,the attribute "name" can be used for a label,and a centroid of the polygon can become a location for a symbol:
So,again - the raster above was made from a single polygonal feature and a set of symbolizers within a single transformer.
Download this example:
http://cdn.亚搏在线safe.com.s3.amazonaws.com/fmepedia/attachments/000002556/SimpleStylingExamples.fmwt
Color | No Style | Positioning | Smoothing | Properties | Comp-op | |
Building | x | x | x | |||
Line | x | x | x | x | x | |
Line Pattern | x | x | x | |||
Markers | x | x | x | x | x | |
Point | x | x | x | |||
Polygon | x | x | x | |||
Polygon Pattern | x | x | x | |||
Raster | x | x | ||||
Shield | x | x | x | x | ||
Text | x | x | x | x |
"Color" section controls not only colors but also opacity.For some symbolizers,such as Line and Polygon Patterns,as well as Points and Raster,colors cannot be set - their color is defined by raster symbols.
Polygonal features have two colors - for the boundary and for the interior.Texts can also have two colors - one for the text itself,and the second - for a halo around it (have a look at the blue label with white border on the image above).
Style
Only "Building" and "Line" symbolizers have "Style" section.For the former,we only can define "Height" and the latter allows creation of dashed lines and also defines how the ends and joins of the lines should look like:
Download this example:
http://cdn.亚搏在线safe.com.s3.amazonaws.com/fmepedia/attachments/000002556/LineStyles.fmw
We can adjust positions of the features in some symbolizers."Line" symbolizer allows specifying only an offset:
For "Point" and especially for "Text" symbolizers,Positioning controls a lot of different aspects of placement,among which are offsets,location choices,conflict resolution,etc.
Smoothing is an operation of vertex displacement for a smoother look of the original shape.It can be applied to lines and polygons,as well as patterns.The image below shows the difference between smoothing set to 0 (on the left) versus smoothing equal to 1:
"Properties" section controls the pattern symbols,which are usually rasters in PNG format or,in some cases,vector symbols in SVG format.Properties for "Text"and "Shield" symbolizers also define font style and size.
Comp-op (or Compositing operations) tell layers how they should interact when they are placed on top of each other.
For those who are familiar with the advanced graphics editors such as Photoshop or GIMP,it should be easy to get an idea how comp-ops work (they are called "blending modes"),for those who are new to these operations,playing with Mapnik's comp-ops is a good chance to learn about this exciting and powerful functionality.Here we only list the available operations and give a simple example of their use:
These operations control how layers should mask each other:
These operations control how layers will blend with each other:
Here is an example of using a compositing operation - a single line is styled seven times with different widths,and the layers are blended with a "Plus" comp-op:
Download this example:
http://cdn.亚搏在线safe.com.s3.amazonaws.com/fmepedia/attachments/000002556/CompOpPlus_Smoothing.fmw
This section includes several examples of MapnikRasterizer use
Two similar examples of Vancouver Rapid transit system (Skytrain).The first example uses arterial routes as a visual aid for orientation,the second example has an orthophoto image as a background.
Example 1:http://cdn.亚搏在线safe.com.s3.amazonaws.com/fmepedia/attachments/000002556/VancouverRapidTransit.fmwt
Example 2:http://cdn.亚搏在线safe.com.s3.amazonaws.com/fmepedia/attachments/000002556/VancouverRapidTransit2.fmwt
Two Vancouver streets examples.The first example shows how to sort and style features using attributes,the second example shows how symbology can be read from an external file or a database.
Example 1:http://cdn.亚搏在线safe.com.s3.amazonaws.com/fmepedia/attachments/000002556/MapnikVancouverStreets.fmwt
Example 2:http://cdn.亚搏在线safe.com.s3.amazonaws.com/fmepedia/attachments/000002556/MapnikVancouverStreetsExternalSymbology.fmwt
A simple example with the Building symbolizer,which gives a 3D feeling to a 2D map.It shows that not only buildings can be styled in this way,but also other polygonal features such as blocks and even stroked texts:
http://cdn.亚搏在线safe.com.s3.amazonaws.com/fmepedia/attachments/000002556/MapnikBuildingSymbolizer.fmwt
An example that shows how to use point clouds for random symbol placement:
http://cdn.亚搏在线safe.com.s3.amazonaws.com/fmepedia/attachments/000002556/IrregularSymbolPattern.fmwt
A map inspired by a collection of maps with faces made by Ed Fairborn (http://edfairburn.com/).Unlike Ed's drawings,this map is made fully automatically with FME:
http://cdn.亚搏在线safe.com.s3.amazonaws.com/fmepedia/attachments/000002556/FaceOfContours.fmwt
A simple workspace with lots of fabric textures:
http://cdn.亚搏在线safe.com.s3.amazonaws.com/fmepedia/attachments/000002556/ArtVancouverFabric.fmwt
© 2019 亚搏在线Safe Software Inc |Legal