<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ALPSTEIN outdoor geo technology &#187; Mapnik</title>
	<atom:link href="http://www.alpstein.com/blog/outdoor-geo-technology/category/mapnik/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.alpstein.com/blog/outdoor-geo-technology</link>
	<description>ALPSTEIN weblog - Rund um die Themen Outdoor, Geo und Technologie</description>
	<lastBuildDate>Fri, 18 Feb 2011 14:38:30 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Nikweb &#8211; Mapnik GeoJSON Web Service for nice Static Maps</title>
		<link>http://www.alpstein.com/blog/outdoor-geo-technology/2010/02/05/nikweb-mapnik-geojson-web-service-for-nice-static-maps/</link>
		<comments>http://www.alpstein.com/blog/outdoor-geo-technology/2010/02/05/nikweb-mapnik-geojson-web-service-for-nice-static-maps/#comments</comments>
		<pubDate>Fri, 05 Feb 2010 15:12:08 +0000</pubDate>
		<dc:creator>Martin</dc:creator>
				<category><![CDATA[Mapnik]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[Static Maps]]></category>

		<guid isPermaLink="false">http://www.alpstein.com/blog/outdoor-geo-technology/?p=181</guid>
		<description><![CDATA[At the end of last year, a new open source GIS tool slipped into Google Code. Nikweb is a GeoJSON web service for Mapnik, enabling you to render feature data you submit into a map. It was annouced as a new tool with the Mapnik 0.7.0 release and it&#8217;s been licensed by Alpstein Tourismus GmbH [...]]]></description>
			<content:encoded><![CDATA[<p>At the end of last year, a new open source GIS tool slipped into Google Code. <a title="Nikweb" href="http://code.google.com/p/mapnik-utils/wiki/Nikweb" target="_blank">Nikweb</a> is a GeoJSON web service for Mapnik, enabling you to render feature data you submit into a map. It was <a title="Slashgeo Mapnik 070 annoucement" href="http://technology.slashgeo.org/article.pl?sid=10/01/24/1640251" target="_blank">annouced as a new tool with the Mapnik 0.7.0 release</a> and it&#8217;s been licensed by <a title="Alpstein Tourismus GmbH &amp; Co. KG" href="http://www.alpstein-tourismus.de/" target="_blank">Alpstein Tourismus GmbH &amp; Co. KG</a> under the LGPL as part of the <a title="Mapnik Utils Project" href="http://code.google.com/p/mapnik-utils" target="_blank">mapnik-utils</a> project.</p>
<p>Mapnik is much valued for its <a title="High quality map rendering" href="http://linfiniti.com/2009/08/harnassing-mapnik-for-high-quality-map-rendering/" target="_blank">beautiful cartography</a>.  Here at Alpstein we use <a title="Mapnik" href="http://www.mapnik.org" target="_blank">Mapnik</a> for all sorts of map rendering across <a title="outdooractive" href="http://www.outdooractive.com/de/" target="_blank">outdooractive.com</a> and other sites. One requirement we kept running into was how to produce nice &#8220;static&#8221; maps for use on pages where an interactive map wasn&#8217;t necessary, or for offline use in print.<br />
We started with several GeoServer instances some time ago. We decided to switch to Mapnik because of the rendering advantages of Mapnik at that time. And we wanted to get rid of the need to connect each GeoServer instance to our database instances just to allow GeoServer to have access to the dynamic part of our data (which are tours and points of interest).</p>
<p>So we came up with the idea of having a web service we could submit geometries to, that Mapnik would render together with our base-maps and other layers, add labels, and return the finished map. A bit like <a title="Google Static Maps-API" href="http://code.google.com/intl/de-DE/apis/maps/documentation/staticmaps/" target="_blank">Google Static Maps-API</a>, <a title="Yahoo! - Map Image API" href="http://developer.yahoo.com/maps/rest/V1/" target="_blank">Yahoo! Map Image API</a> or the <a title="Open Street Map static maps API" href="http://pafciu17.dev.openstreetmap.org/" target="_blank">Open Street Map static maps API</a>, except:</p>
<ul>
<li>Takes geometries and attributes, and applies styling to them, including labels.</li>
<li>Can render any data with any base-maps and any projection.</li>
<li>Can render data &#8220;within&#8221; the map, not just on top of it. eg. draw a submitted polygon under the roads and labels.</li>
<li>Uses standard <a title="GeoJSON" href="http://www.geojson.org" target="_blank">GeoJSON</a> and <a title="Mapnik XML Map Definitions" href="http://trac.mapnik.org/wiki/XMLGettingStarted" target="_blank">Mapnik&#8217;s XML map definitions</a>.</li>
<li>Able to output any of Mapnik&#8217;s formats (images, PDF, SVG)</li>
</ul>
<p>Nikweb is the result. So, now we can take our feature data, which is just a <a title="GeoJSON Feature Collection" href="http://geojson.org/geojson-spec.html" target="_blank">GeoJSON FeatureCollection</a> with some extra fields (e.g. padding values, bbox calculation, &#8230;) and submit it via HTTP POST to Nikweb. It then gets rendered into our Map XML file, where the GeoJSON gets loaded into the layer named &#8220;NIKWEB&#8221;. Any filtering and style rules defined by our map XML apply as normal, the &#8220;properties&#8221; in our GeoJSON object are available as attributes to filter on or use for labels or symbol selection.</p>
<p>The extra fields in our JSON define how our map is rendered &#8211; defining the width, height, bounding-box, padding, and output format (these are mostly optional). They are comparable to <a title="Wikipedia - OGC Web Map Service" href="http://de.wikipedia.org/wiki/Web_Map_Service" target="_blank">OGC Web Map Service</a> GetMap Parameters. The result of our request is an image (or soon: PDF &amp; SVG) of a our completed map.</p>
<p>See the following JSON example to see how easy a GeoJson LINESTRING and a GeoJson Point may be rendered into a complex map:</p>
<pre><code>
{
 "width":600, "height":400,
 "format":"image\/jpeg",
 "bbox_image":[1129892.83155173,6035613.97648191,1135458.80609139,6036934.02767432],
 "type":"FeatureCollection",
 "features":
   [
    { "geometry": { "type":"Linestring", "coordinates": [ [10.15337,47.57021],[10.188389,47.577621],[10.192509,47.571602],[10.15337,47.57021],[10.15337,47.57021] ] },
      "type":"Feature",
      "properties": { "class":"tour_geom" } },
    { "geometry": { "type":"Point", "coordinates":[10.15337,47.57021] },
      "type":"Feature",
      "properties":{"class":"tour_start"}
    }
   ]
}
</code></pre>
<p>The following map image shows how the input data from above gets rendered on top of Alpstein&#8217;s Outdoor Map cartography (the map data is held inside a postgresql/postgis data base on server side and all style definitions are done with help of a mapnik style file):</p>
<div id="attachment_250" class="wp-caption alignnone" style="width: 610px"><img class="size-full wp-image-250" title="nikweb.example" src="http://www.alpstein.com/blog/outdoor-geo-technology/wp-content/uploads/2010/02/nikweb.example.jpeg" alt="Nikweb Beispiel" width="600" height="400" /><p class="wp-caption-text">Nikweb Beispiel</p></div>
<p>Nikweb comes bundled with a <a title="WebOb" href="http://pythonpaste.org/webob/" target="_blank">WebOb</a> application (runs in any WSGI container, and includes a simple server) as well as some <a title="Django" href="http://www.djangoproject.com/" target="_self">Django</a> views for building it into a <a title="GeoDjango" href="http://geodjango.org" target="_blank">GeoDjango</a> app.</p>
<p>Feedback and contributions are most welcome, leave some comments below or jump onto the mapnik mailing lists.</p>
<p>Nikweb:</p>
<ul>
<li><a title="Nikweb Homepage" href="http://code.google.com/p/mapnik-utils/wiki/Nikweb" target="_blank">mapnik-utils Homepage</a></li>
<li><a title="mapnik-utils Homepage" href="http://code.google.com/p/mapnik-utils" target="_blank">mapnik-utils Homepage</a></li>
<li><a title="mapnik-utils Issue Tracker" href="http://code.google.com/p/mapnik-utils/issues/list" target="_blank">mapnik-utils Issue Tracker</a></li>
<li><a title="Mapnik Mailing Lists" href="http://mapnik.org/contact/" target="_blank">Mapnik Mailing Lists</a></li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://www.alpstein.com/blog/outdoor-geo-technology/2010/02/05/nikweb-mapnik-geojson-web-service-for-nice-static-maps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

