Adding Icon’s to OSM using Mapnik

If you are not familiar with Mapnik, then please  read my previous blogs. This blog is to add icon’s to your map.

STEP 1

Download icon’s you want to add to your map. You can use link : http://www.flaticon.com/packs/material-design

STEP 2

Add following code, and attach your shapefile or osm file in parameter.

<Style name="points_layer"> 
 <Rule>
 <MaxScaleDenominator>250000</MaxScaleDenominator>
 <Filter>'building'</Filter>
 <PointSymbolizer file= "/home/abhinav/Desktop/ldh/shapefile/shape/buildings.png" type="png" width="16" height="16" />
 </Rule> 
 <Rule>
 <MaxScaleDenominator>250000</MaxScaleDenominator>
 <Filter>'hostipal'</Filter>
 <PointSymbolizer file= "/home/abhinav/Desktop/ldh/shapefile/shape/hospital-marker.svg" type="png" width="16" height="16" />
 </Rule>
 <Rule>
 <MaxScaleDenominator>250000</MaxScaleDenominator>
 <Filter>'gedi'</Filter>
 <PointSymbolizer file= "/home/abhinav/Desktop/ldh/shapefile/shape/gedi.png" type="png" width="16" height="16" />
 </Rule>
 <Rule>
 <MaxScaleDenominator>250000</MaxScaleDenominator>
 <Filter>'school'</Filter>
 <PointSymbolizer file= "/home/abhinav/Desktop/ldh/shapefile/shape/school.png" type="png" width="16" height="16" />
 </Rule> 
 </Style> 
 <Layer name="points_layer" >
 <StyleName>points_layer</StyleName>
 <Datasource>
 <Parameter name="type">shape</Parameter>
 <Parameter name="file">points.shp</Parameter>
 </Datasource>
 </Layer>

OUTPUT:

Here is a zoomed image of rendered output after adding icon’s to map.

Screenshot from 2017-06-27 11:51:36.png

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s