<?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>ItOpen - Soluzioni WebGIS Open Source &#187; WebGis</title>
	<atom:link href="http://www.itopen.it/category/programmazione/webgis/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.itopen.it</link>
	<description>[lang_en]Open Web Solutions: WebGis, Open Source development[/lang_en][lang_it]Soluzioni WebGIS e sviluppo software Open Source[lang_it]</description>
	<lastBuildDate>Tue, 31 Jan 2012 14:19:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Serving your map tiles 30 times faster</title>
		<link>http://www.itopen.it/2012/01/17/serving-your-map-tiles-30-times-faster/</link>
		<comments>http://www.itopen.it/2012/01/17/serving-your-map-tiles-30-times-faster/#comments</comments>
		<pubDate>Tue, 17 Jan 2012 18:03:45 +0000</pubDate>
		<dc:creator>Alessandro Pasotti</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[GIS]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Sysadmin]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[WebGis]]></category>

		<guid isPermaLink="false">http://www.itopen.it/?p=716</guid>
		<description><![CDATA[Recently I&#8217;ve been experimenting with TileStache tiles caching system, which is similar to TileCache and other tile caching systems in scope. TileStache revealed itself as a powerful and flexible product and was very good to cache tiles generated with my Django-backed mapscript-powered WMS server. Caching and serving tiles with TileStache was by far faster then [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I&#8217;ve been experimenting with <a href="http://tilestache.org">TileStache</a> tiles caching system, which is similar to TileCache and other tile caching systems in scope.</p>
<p>TileStache revealed itself as a powerful and flexible product and was very good to cache tiles generated with my Django-backed mapscript-powered WMS server. Caching and serving tiles with TileStache was by far faster then running the whole mapscript WMS machinery.</p>
<p>But I wanted to do more: if I could just convince nginx to serve the tiles directly from disk, this would have been even faster. Of course for this to work, TileStache must be configured to cache tiles on disk, which is what you normally want.</p>
<p>nginx is really good at serving static files and it is luckily wery flexible and easy to configure (once you know what to do).</p>
<p>The following configuration uses named regular expression captures and a <strong>try_files</strong> instruction to check for the tile existance, if found, the tile is served directly, if not found the internal redirect to the @django named location takes place.<br />
The 404 trick in the base location (/) was necessary to avoid duplication of the @django location content, but there might be a better way.</p>
<h2>nginx configuration file</h2>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">server <span style="color: #009900;">&#123;</span>
    listen   <span style="color: #CC0000;">88</span> <span style="color: #003366; font-weight: bold;">default</span><span style="color: #339933;">;</span>
    server_name  localhost<span style="color: #339933;">;</span>
    access_log  <span style="color: #339933;">/</span><span style="color: #003366; font-weight: bold;">var</span><span style="color: #339933;">/</span>log<span style="color: #339933;">/</span>nginx<span style="color: #339933;">/</span>access.<span style="color: #660066;">log</span><span style="color: #339933;">;</span>
    rewrite  <span style="color: #3366CC;">&quot;^/[a-z]{2}/(static|media)/(.*)$&quot;</span>  <span style="color: #009966; font-style: italic;">/$1/</span>$2<span style="color: #339933;">;</span>
    root <span style="color: #339933;">/</span>www<span style="color: #339933;">/</span>django_app<span style="color: #339933;">/;</span>
&nbsp;
    location  <span style="color: #009966; font-style: italic;">/media/</span> <span style="color: #009900;">&#123;</span>
        alias <span style="color: #339933;">/</span>www<span style="color: #339933;">/</span>django<span style="color: #339933;">/</span>contrib<span style="color: #339933;">/</span>admin<span style="color: #339933;">/</span>media<span style="color: #339933;">/;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    location  <span style="color: #009966; font-style: italic;">/static/</span> <span style="color: #009900;">&#123;</span>
        alias <span style="color: #339933;">/</span>www<span style="color: #339933;">/</span>django_app<span style="color: #339933;">/</span>site_media<span style="color: #339933;">/;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    location ~ <span style="color: #339933;">^/</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">?&lt;</span>lang_code<span style="color: #339933;">&gt;</span>..<span style="color: #009900;">&#41;</span><span style="color: #339933;">/</span>resource<span style="color: #339933;">/</span>tiles<span style="color: #339933;">/</span><span style="color: #CC0000;">1</span>\.0\.0<span style="color: #339933;">/</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">?&lt;</span>tile_path<span style="color: #339933;">&gt;</span>.<span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span>$ <span style="color: #009900;">&#123;</span>
        alias <span style="color: #339933;">/</span>tmp<span style="color: #339933;">/</span>stache<span style="color: #339933;">/;</span>
        add_header X<span style="color: #339933;">-</span>Static <span style="color: #003366; font-weight: bold;">super</span><span style="color: #339933;">;</span>
        try_files $http_host<span style="color: #339933;">/</span>$lang_code<span style="color: #339933;">/</span>$tile_path <span style="color: #339933;">@</span>django<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    location <span style="color: #339933;">/</span> <span style="color: #009900;">&#123;</span>
        add_header X<span style="color: #339933;">-</span>Static hit<span style="color: #339933;">;</span>
        error_page <span style="color: #CC0000;">404</span> <span style="color: #339933;">=</span> <span style="color: #339933;">@</span>django<span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #CC0000;">404</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    location <span style="color: #339933;">@</span>django <span style="color: #009900;">&#123;</span>
        add_header X<span style="color: #339933;">-</span>Static miss<span style="color: #339933;">;</span>
        proxy_pass http<span style="color: #339933;">:</span><span style="color: #006600; font-style: italic;">//127.0.0.1:8000;</span>
        proxy_set_header Host $http_host<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<h2>Results</h2>
<p>niginx is listening on port 88 and the dev server (I&#8217;m using werkzeug in this case) is listening on port 8080.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ab <span style="color: #660033;">-c</span> <span style="color: #000000;">100</span> <span style="color: #660033;">-n</span> <span style="color: #000000;">1000</span> http:<span style="color: #000000; font-weight: bold;">//</span>localhost:<span style="color: #000000;">88</span><span style="color: #000000; font-weight: bold;">/</span>it<span style="color: #000000; font-weight: bold;">/</span>resource<span style="color: #000000; font-weight: bold;">/</span>tiles<span style="color: #000000; font-weight: bold;">/</span>1.0.0<span style="color: #000000; font-weight: bold;">/</span>track_4<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">0</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">0</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">0</span>.png
&nbsp;
Concurrency Level:      <span style="color: #000000;">100</span>
Time taken <span style="color: #000000; font-weight: bold;">for</span> tests:   <span style="color: #000000;">0.084</span> seconds
Complete requests:      <span style="color: #000000;">1000</span>
Failed requests:        <span style="color: #000000;">0</span>
Write errors:           <span style="color: #000000;">0</span>
Total transferred:      <span style="color: #000000;">7553744</span> bytes
HTML transferred:       <span style="color: #000000;">7302912</span> bytes
Requests per second:    <span style="color: #000000;">11902.92</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #666666; font-style: italic;">#/sec] (mean)</span>
Time per request:       <span style="color: #000000;">8.401</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>ms<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>mean<span style="color: #7a0874; font-weight: bold;">&#41;</span>
Time per request:       <span style="color: #000000;">0.084</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>ms<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>mean, across all concurrent requests<span style="color: #7a0874; font-weight: bold;">&#41;</span>
Transfer rate:          <span style="color: #000000;">87804.31</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>Kbytes<span style="color: #000000; font-weight: bold;">/</span>sec<span style="color: #7a0874; font-weight: bold;">&#93;</span> received</pre></div></div>

<p>With TileStache only:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ab <span style="color: #660033;">-c</span> <span style="color: #000000;">100</span> <span style="color: #660033;">-n</span> <span style="color: #000000;">1000</span> http:<span style="color: #000000; font-weight: bold;">//</span>localhost:<span style="color: #000000;">8000</span><span style="color: #000000; font-weight: bold;">/</span>track_4<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">0</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">0</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">0</span>.png
&nbsp;
Concurrency Level:      <span style="color: #000000;">100</span>
Time taken <span style="color: #000000; font-weight: bold;">for</span> tests:   <span style="color: #000000;">2.944</span> seconds
Complete requests:      <span style="color: #000000;">1000</span>
Failed requests:        <span style="color: #000000;">0</span>
Write errors:           <span style="color: #000000;">0</span>
Non-2xx responses:      <span style="color: #000000;">1000</span>
Total transferred:      <span style="color: #000000;">145000</span> bytes
HTML transferred:       <span style="color: #000000;">0</span> bytes
Requests per second:    <span style="color: #000000;">339.63</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #666666; font-style: italic;">#/sec] (mean)</span>
Time per request:       <span style="color: #000000;">294.438</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>ms<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>mean<span style="color: #7a0874; font-weight: bold;">&#41;</span>
Time per request:       <span style="color: #000000;">2.944</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>ms<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>mean, across all concurrent requests<span style="color: #7a0874; font-weight: bold;">&#41;</span>
Transfer rate:          <span style="color: #000000;">48.09</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>Kbytes<span style="color: #000000; font-weight: bold;">/</span>sec<span style="color: #7a0874; font-weight: bold;">&#93;</span> received</pre></div></div>

<h2>Conclusions</h2>
<p>Unsurprisingly, the solution with files served directly is several times faster: 35 in this test case.</p>
<p>In a production environment, using <strong>mod_wsgi</strong> or <strong>uwsgi</strong>, the fugures may vary, but I&#8217;m confident that the overall speed boost is guaranteed.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itopen.it/2012/01/17/serving-your-map-tiles-30-times-faster/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TileStache Vector simplify provider</title>
		<link>http://www.itopen.it/2012/01/11/tilestache-vector-simplify-provider/</link>
		<comments>http://www.itopen.it/2012/01/11/tilestache-vector-simplify-provider/#comments</comments>
		<pubDate>Wed, 11 Jan 2012 17:19:57 +0000</pubDate>
		<dc:creator>Alessandro Pasotti</dc:creator>
				<category><![CDATA[GIS]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[WebGis]]></category>

		<guid isPermaLink="false">http://www.itopen.it/?p=703</guid>
		<description><![CDATA[This is the third part of the story that I started with part 1: Polymaps, TileStache and SVG CSS styling issues part 2: TileStache Django tiny wrapper during my experiments I wanted to reach the goal of minimize both the bandwith consuption and the number of vector coordinates that the browser needs to handle, this means that [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">This is the third part of the story that I started with</p>
<ul>
<li>part 1: <a title="Permanent Link to Polymaps, TileStache and SVG CSS styling issues" href="http://www.itopen.it/2012/01/05/polymaps-tilestache-and-svg-css-styling-issues/" rel="bookmark">Polymaps, TileStache and SVG CSS styling issues</a></li>
<li>part 2: <a title="Permanent Link to TileStache Django tiny wrapper" href="http://www.itopen.it/2012/01/09/tilestache-django-tiny-wrapper/" rel="bookmark">TileStache Django tiny wrapper</a></li>
</ul>
<p>during my experiments I wanted to reach the goal of minimize both the bandwith consuption and the number of vector coordinates that the browser needs to handle, this means that if we need to show complex geometries, for example a set of mountain hiking paths for an overall of 250000 point, we absolutely need a way to simplify features at lower zoom levels.</p>
<p>TileStache doesn&#8217;t support this out-of-the box, so I started playing with a clone of the Vector provider and ended up with a <a title="My branch on github" href="https://github.com/elpaso/TileStache/tree/vector-simplify" target="_blank">vector-simplify branch in my fork</a>.</p>
<p>What I&#8217;ve done was basically to add a new &#8220;simplify&#8221; provider configuration parameter, where you can enter the tolerance for <a href="http://en.wikipedia.org/wiki/Ramer%E2%80%93Douglas%E2%80%93Peucker_algorithm">Douglas-Peucker simplification algorhitm</a> in pixel unit. The paramer can be set in TileStache config file as shown here:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">  <span style="color: #3366CC;">&quot;layers&quot;</span><span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #3366CC;">&quot;pmcollection&quot;</span><span style="color: #339933;">:</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #3366CC;">&quot;provider&quot;</span><span style="color: #339933;">:</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #3366CC;">&quot;name&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;vector&quot;</span><span style="color: #339933;">,</span>
            <span style="color: #3366CC;">&quot;driver&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;PostgreSQL&quot;</span><span style="color: #339933;">,</span>
            <span style="color: #3366CC;">&quot;parameters&quot;</span><span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #3366CC;">&quot;dbname&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;polymaps_test&quot;</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">&quot;user&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;xxx&quot;</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">&quot;port&quot;</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;5433&quot;</span><span style="color: #339933;">,</span>                
                <span style="color: #3366CC;">&quot;table&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;pm_points_pmcollection&quot;</span>
            <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
            <span style="color: #3366CC;">&quot;verbose&quot;</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;true&quot;</span><span style="color: #339933;">,</span>
            <span style="color: #3366CC;">&quot;simplify&quot;</span> <span style="color: #339933;">:</span> <span style="color: #CC0000;">0.5</span>
        <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
        <span style="color: #3366CC;">&quot;allowed origin&quot;</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;*&quot;</span>
    <span style="color: #009900;">&#125;</span>
 <span style="color: #009900;">&#125;</span></pre></div></div>

<h3>A picture is worth a thousand words</h3>
<p>Some pictures might be the best way to show how this parameter affects the generated geometries:</p>
<div id="attachment_704" class="wp-caption " style="width: 458px"><img class="size-full wp-image-704  " title="tilestache_simplify_tile" src="http://www.itopen.it/wp-content/uploads/2012/01/tilestache_simplify_tile.png" alt="" width="448" height="227" /><p class="wp-caption-text">This is a single tile, the original geometry is in red, the simplified geometry in green/yellow and an over-simplified geometry in blue.</p></div>
<p>The following overall views show all the details:</p>
<div id="attachment_705" class="wp-caption " style="width: 310px"><a href="http://www.itopen.it/wp-content/uploads/2012/01/tilestache_simplify_None.png"><img class="size-medium wp-image-705" title="tilestache_simplify_None" src="http://www.itopen.it/wp-content/uploads/2012/01/tilestache_simplify_None-300x201.png" alt="" width="300" height="201" /></a><p class="wp-caption-text">Original geometry</p></div>
<div id="attachment_708" class="wp-caption " style="width: 310px"><a href="http://www.itopen.it/wp-content/uploads/2012/01/tilestache_simplify_50.png"><img class="size-medium wp-image-708" title="tilestache_simplify_50" src="http://www.itopen.it/wp-content/uploads/2012/01/tilestache_simplify_50-300x201.png" alt="" width="300" height="201" /></a><p class="wp-caption-text">Over-simplified with tolerance 50</p></div>
<div id="attachment_706" class="wp-caption " style="width: 310px"><a href="http://www.itopen.it/wp-content/uploads/2012/01/tilestache_simplify_0.5.png"><img class="size-medium wp-image-706" title="tilestache_simplify_0.5" src="http://www.itopen.it/wp-content/uploads/2012/01/tilestache_simplify_0.5-300x201.png" alt="" width="300" height="201" /></a><p class="wp-caption-text">Simplified with tolerance 0.5</p></div>
<h3>Open issues</h3>
<p>The biggest issue I&#8217;ve encountered was about getting the tolerance in lat-lon WGS84 starting from pixel units, but let me explain why I choose pixel units in the first place: I think that pixel units are are the best choice because normally we don&#8217;t care about feature details which are below 1 pixel, we simply cannot see them. Using pixel units we also get the advantage of using a single number for all zoom levels, a more complicated approach would consist in using separate values for each zoom level. Translating pixel units to decimal degrees is not possible without approximations, I just hope that my approach works in most situations.</p>
<p>Another strange thing I noted in the library is that the bounding box used for clipping (which is a rectangle) is built using 16 points instead of 4. This means that after clipping we end up with a geometry that have many more points that it needs. I&#8217;m still waiting for a clarification I&#8217;ve asked in the TileStache ML, but in the meantime I patched my branch to use a normal 4 points rectangle and everything seems to work fine (and with smaller geojson responses).</p>
<h3>Conclusions</h3>
<p>TileStache confirmed to be a valuable tool for web GIS developers, it&#8217;s well written and supported and easily expandable, absolutely worths a try.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itopen.it/2012/01/11/tilestache-vector-simplify-provider/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TileStache Django tiny wrapper</title>
		<link>http://www.itopen.it/2012/01/09/tilestache-django-tiny-wrapper/</link>
		<comments>http://www.itopen.it/2012/01/09/tilestache-django-tiny-wrapper/#comments</comments>
		<pubDate>Mon, 09 Jan 2012 17:47:09 +0000</pubDate>
		<dc:creator>Alessandro Pasotti</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[GIS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Programmazione]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[WebGis]]></category>

		<guid isPermaLink="false">http://www.itopen.it/?p=697</guid>
		<description><![CDATA[This is the second part of the story about my experiments with the wonderful TileStache that I started with TileStache and Polymaps SVG experiments. First, I would like to thank Michal for the quick patch inclusion, the Polymaps patch is still waiting for the pull and the Django admin patch is awating for somebody to [...]]]></description>
			<content:encoded><![CDATA[<p>This is the second part of the story about my experiments with the wonderful TileStache that I started with <a href="http://www.itopen.it/2012/01/05/polymaps-tilestache-and-svg-css-styling-issues/">TileStache and Polymaps SVG experiments</a>.</p>
<p>First, I would like to thank Michal for the quick patch inclusion, the Polymaps patch is still waiting for the pull and the Django admin patch is awating for somebody to take care of that 18-months-old bug.</p>
<p>My experiments have continued with Django integration, I just wanted to see how easy it was (and it was really easy indeed). There aren&#8217;t any clear advantages using a Django app instead of the standalone TileStache server, but writing the wrapper was a nice exercise to learn something more about TileStache and Polymaps, and having all the pieces into one place is always tempting for me (not to mention that you can dribble the <a href="http://en.wikipedia.org/wiki/Cross-Origin_Resource_Sharing">CORS</a> completely).</p>
<p>The wapper consists in a single router rule in urlconf:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">    url<span style="color: black;">&#40;</span>r<span style="color: #483d8b;">'^tiles/(?P&lt;layer_name&gt;[^/]+)/(?P&lt;z&gt;[^/]+)/(?P&lt;x&gt;[^/]+)/(?P&lt;y&gt;[^/]+)<span style="color: #000099; font-weight: bold;">\.</span>(?P&lt;extension&gt;.+)$'</span>, <span style="color: #483d8b;">'pm_points.views.tiles'</span>, name=<span style="color: #483d8b;">'tiles_url'</span><span style="color: black;">&#41;</span>,</pre></div></div>

<p>&#8230; a view for the tiles (get_config implements a singleton to avoid parsing TileStache config every time):</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">&nbsp;
<span style="color: #808080; font-style: italic;"># proper imports go here...</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> tiles<span style="color: black;">&#40;</span>request, layer_name, z, x, y, extension<span style="color: black;">&#41;</span>:
    <span style="color: #483d8b;">&quot;&quot;&quot;
    Proxy to tilestache
    {X} - coordinate column.
    {Y} - coordinate row.
    {B} - bounding box.
    {Z} - zoom level.
    {S} - host.
    &quot;&quot;&quot;</span>
    config = get_config<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    path_info = <span style="color: #483d8b;">&quot;%s/%s/%s/%s.%s&quot;</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>layer_name, z, x, y, extension<span style="color: black;">&#41;</span>
    coord, extension = TileStache.<span style="color: black;">splitPathInfo</span><span style="color: black;">&#40;</span>path_info<span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span>:<span style="color: black;">&#93;</span>
    mimetype, content = TileStache.<span style="color: black;">getTile</span><span style="color: black;">&#40;</span>config.<span style="color: black;">layers</span><span style="color: black;">&#91;</span>layer_name<span style="color: black;">&#93;</span>, coord, extension<span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">return</span> HttpResponse<span style="color: black;">&#40;</span>content, mimetype=mimetype<span style="color: black;">&#41;</span></pre></div></div>

<p>&#8230; and a simple view for the map:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> home<span style="color: black;">&#40;</span>request<span style="color: black;">&#41;</span>:
    <span style="color: #483d8b;">&quot;&quot;&quot;
    Pass layers by
    &quot;&quot;&quot;</span>
    config = get_config<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    layer_urls = <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span>
    <span style="color: #ff7700;font-weight:bold;">for</span> l <span style="color: #ff7700;font-weight:bold;">in</span> config.<span style="color: black;">layers</span>:
        <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">isinstance</span><span style="color: black;">&#40;</span>config.<span style="color: black;">layers</span><span style="color: black;">&#91;</span>l<span style="color: black;">&#93;</span>.<span style="color: black;">provider</span>, TileStache.<span style="color: black;">Providers</span>.<span style="color: black;">Vector</span>.<span style="color: black;">Provider</span><span style="color: black;">&#41;</span>:
            layer_urls.<span style="color: black;">append</span><span style="color: black;">&#40;</span>reverse<span style="color: black;">&#40;</span><span style="color: #483d8b;">'tiles_url'</span>, args=<span style="color: black;">&#91;</span>l, <span style="color: #483d8b;">'{Z}'</span>, <span style="color: #483d8b;">'{X}'</span>, <span style="color: #483d8b;">'{Y}'</span>, <span style="color: #483d8b;">'geojson'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>.<span style="color: black;">replace</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'%7B'</span>, <span style="color: #483d8b;">'{'</span><span style="color: black;">&#41;</span>.<span style="color: black;">replace</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'%7D'</span>, <span style="color: #483d8b;">'}'</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">return</span> render_to_response<span style="color: black;">&#40;</span><span style="color: #483d8b;">'home.html'</span>, <span style="color: black;">&#123;</span> <span style="color: #483d8b;">'layer_urls'</span> :  layer_urls<span style="color: black;">&#125;</span>, context_instance=RequestContext<span style="color: black;">&#40;</span>request<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span></pre></div></div>

<p>&#8230; and a template for Polymaps (I paste the js part only):</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">&nbsp;
    <span style="color: #003366; font-weight: bold;">var</span> po <span style="color: #339933;">=</span> org.<span style="color: #660066;">polymaps</span><span style="color: #339933;">,</span>
        map<span style="color: #339933;">,</span>
        layers <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
        stylist<span style="color: #339933;">;</span>
        jQuery<span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            map <span style="color: #339933;">=</span> po.<span style="color: #660066;">map</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
                .<span style="color: #660066;">container</span><span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;map&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>po.<span style="color: #660066;">svg</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;svg&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
                .<span style="color: #660066;">center</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>lat<span style="color: #339933;">:</span> <span style="color: #CC0000;">40</span><span style="color: #339933;">,</span> lon<span style="color: #339933;">:</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
                .<span style="color: #660066;">zoomRange</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">16</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
                .<span style="color: #660066;">zoom</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#41;</span>
                .<span style="color: #660066;">add</span><span style="color: #009900;">&#40;</span>po.<span style="color: #660066;">interact</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
                .<span style="color: #660066;">add</span><span style="color: #009900;">&#40;</span>po.<span style="color: #660066;">hash</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
                <span style="color: #339933;">;</span>
&nbsp;
            map.<span style="color: #660066;">add</span><span style="color: #009900;">&#40;</span>po.<span style="color: #660066;">image</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
                .<span style="color: #660066;">url</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;http://s3.amazonaws.com/com.modestmaps.bluemarble/{Z}-r{Y}-c{X}.jpg&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
            stylist <span style="color: #339933;">=</span> po.<span style="color: #660066;">stylist</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
                .<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'class'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>d<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                    <span style="color: #000066; font-weight: bold;">return</span> d.<span style="color: #660066;">geometry</span>.<span style="color: #660066;">type</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'_'</span> <span style="color: #339933;">+</span> d.<span style="color: #660066;">properties</span>.<span style="color: #660066;">id</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
                .<span style="color: #660066;">title</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>d<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #000066; font-weight: bold;">return</span> d.<span style="color: #660066;">properties</span>.<span style="color: #000066;">name</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
                <span style="color: #339933;">;</span>
&nbsp;
            <span style="color: #009900;">&#123;</span><span style="color: #339933;">%</span> <span style="color: #000066; font-weight: bold;">for</span> lay_url <span style="color: #000066; font-weight: bold;">in</span> layer_urls <span style="color: #339933;">%</span><span style="color: #009900;">&#125;</span>
            <span style="color: #003366; font-weight: bold;">var</span> layer <span style="color: #339933;">=</span> po.<span style="color: #660066;">geoJson</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
                .<span style="color: #660066;">url</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;{{ lay_url|safe }}&quot;</span><span style="color: #009900;">&#41;</span>
                .<span style="color: #660066;">zoom</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>z<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                    <span style="color: #000066; font-weight: bold;">return</span> z<span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
                .<span style="color: #660066;">id</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'pmcollection'</span><span style="color: #009900;">&#41;</span>
                .<span style="color: #660066;">on</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;load&quot;</span><span style="color: #339933;">,</span>  stylist<span style="color: #009900;">&#41;</span>
                .<span style="color: #660066;">on</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'show'</span><span style="color: #339933;">,</span> stylist<span style="color: #009900;">&#41;</span>
                <span style="color: #339933;">;</span>
            map.<span style="color: #660066;">add</span><span style="color: #009900;">&#40;</span>layer<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            layers.<span style="color: #660066;">push</span><span style="color: #009900;">&#40;</span>layer<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#123;</span><span style="color: #339933;">%</span> endfor <span style="color: #339933;">%</span><span style="color: #009900;">&#125;</span>
&nbsp;
            map.<span style="color: #660066;">add</span><span style="color: #009900;">&#40;</span>po.<span style="color: #660066;">compass</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
                .<span style="color: #660066;">pan</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;none&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            map.<span style="color: #660066;">container</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">setAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;class&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;mymap&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Quick and dirty, it also dynamically adds layers to the Polymap.</p>
<p>This story continues with: <a href="http://www.itopen.it/2012/01/11/tilestache-vector-simplify-provider/">TileStache Vector simplify provider</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.itopen.it/2012/01/09/tilestache-django-tiny-wrapper/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Polymaps, TileStache and SVG CSS styling issues</title>
		<link>http://www.itopen.it/2012/01/05/polymaps-tilestache-and-svg-css-styling-issues/</link>
		<comments>http://www.itopen.it/2012/01/05/polymaps-tilestache-and-svg-css-styling-issues/#comments</comments>
		<pubDate>Thu, 05 Jan 2012 16:38:00 +0000</pubDate>
		<dc:creator>Alessandro Pasotti</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[GIS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Programmazione]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[WebGis]]></category>

		<guid isPermaLink="false">http://www.itopen.it/?p=682</guid>
		<description><![CDATA[A few days ago I started playing with Polymaps and TileStache, two very promising WebGIS building tools. The final goal of this experiments was the integration with Django. Polymaps Polymaps is a Javascript library aimed to display svg maps in a web page, recently I&#8217;ve watched to an interesting talk about a Django-powered app built [...]]]></description>
			<content:encoded><![CDATA[<p>A few days ago I started playing with <a href="http://polymaps.org/">Polymaps</a> and <a href="http://tilestache.org/">TileStache</a>, two very promising WebGIS building tools.</p>
<p>The final goal of this experiments was the integration with Django.</p>
<h2>Polymaps</h2>
<p>Polymaps is a Javascript library aimed to display svg maps in a web page, recently I&#8217;ve watched to an interesting talk about a Django-powered app built on top of Polymaps: </p>
<p><iframe src="http://blip.tv/play/AYLUmmQC.html?p=1" width="550" height="442" frameborder="0" allowfullscreen></iframe><embed type="application/x-shockwave-flash" src="http://a.blip.tv/api.swf#AYLUmmQC" style="display:none"></embed></p>
<p>The main reason to give Polymaps a try is the interesting support to tiled vector layers, as far as I know a unique feature.</p>
<p>I&#8217;ve found the documentation of Polymaps a bit obscure and still incomplete (I just hope it isn&#8217;t another facade Open Source product where the lack of documentation and community support limits the use to commercial projects).</p>
<p>A quick look in the code shows no comments and rather obscure variable names, debbugging this library would certainly be a nightmare if you&#8217;re not the author, if you compare the source code with OpenLayers&#8217;s code you get the idea.</p>
<p>BTW I managed to make it work in a few hours (with all the server stuff).</p>
<h2>TileStache</h2>
<p>TileStache is a python library aimed to build, cache and manage map tiles. It&#8217;s similar to TileCache in scope and uses the well known Mapnik renderer while the data provider is implemented with shapely and OGR and can read the most widely used formats (postgis, shapefile, geojson).</p>
<p>TileStache is the ideal companion to Polymaps because it can handle and cache vector tiles (geojson) through the Vector class (don&#8217;t even try to use the PostgreSQL class you can find in Goodies, it&#8217;s kind of unofficially deprecated and it will let you waste your time).</p>
<p>I had to fork the project on github and made a pull request to fix the missing &#8220;port&#8221; parameter to the DB connection since I&#8217;m using a not-standard port.</p>
<h2>SVG CSS</h2>
<p>I admit I am a true beginner with SVG and while I was trying to experiment with the stylist features of Polymaps  I discovered some counter-intuitive (at least for me, coming from XHTML CSS) behaviours:</p>
<p>You can define styles in three ways:</p>
<ol>
<li>CSS rules</li>
<li>&#8220;style&#8221; attribute of the SVG element</li>
<li>individual attributes (&#8220;stroke&#8221;, &#8220;fill&#8221; etc. etc.) of the SVG element</li>
</ol>
<p>Strange enough, the priority is top-down, while I would have expected that point 3 had a higher priority.</p>
<p>Another thing worths noting is that what distinguish a polygon from a linestring in the Polymaps generated &#8220;path&#8221; SVG element is just that the &#8220;d&#8221; element (which contains the geometry) ends with a &#8220;Z&#8221;.</p>
<p>This is a linestring:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;path</span> <span style="color: #000066;">d</span>=<span style="color: #ff0000;">&quot;M101.99999715555555,189.9999971369224</span>
<span style="color: #009900;">L75.00000142222234,219.00000190473258</span>
<span style="color: #009900;">L75.00000142222234,242.49999834108655</span>
<span style="color: #009900;">L94.49999928888906,242.99999806558844</span>
<span style="color: #009900;">L102.49999928888906,255.4999976705726</span>
<span style="color: #009900;">L101.99970702222231,256&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>;</pre></div></div>

<p>This is a polygon:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;path</span> <span style="color: #000066;">d</span>=<span style="color: #ff0000;">&quot;M95.07080533333351,256.00000052462633</span>
<span style="color: #009900;">L0,196.67516186124612</span>
<span style="color: #009900;">L0,192.0000022835775</span>
<span style="color: #009900;">L0,128.0000001888236L0,70.92093168072711</span>
<span style="color: #009900;">L175.92470186666674,0.000006325172648757871</span>
<span style="color: #009900;">L192,0.000006325172648757871</span>
<span style="color: #009900;">L256,0.000006325172648757871</span>
<span style="color: #009900;">L256,64.00000444302805</span>
<span style="color: #009900;">L256,128.0000001888236</span>
<span style="color: #009900;">L256,160.99230434784874</span>
<span style="color: #009900;">L113.66593991111131,256.00000052462633Z&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>;</pre></div></div>

<p>Styling the plygon fill without hitting linestring in a GEOMETRYCOLLECTION layer turned out to be quite troublesome.</p>
<p>I ended up with a CSS-3 attribute CSS rule:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.layer</span> path <span style="color: #00AA00;">&#123;</span>
fill<span style="color: #00AA00;">:</span> cyan<span style="color: #00AA00;">;</span>
fill-opacity<span style="color: #00AA00;">:</span> .85<span style="color: #00AA00;">;</span>
stroke<span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#012</span><span style="color: #00AA00;">;</span>
stroke-linecap<span style="color: #00AA00;">:</span> round<span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.layer</span> <span style="color: #993333;">circle</span> <span style="color: #00AA00;">&#123;</span>
fill<span style="color: #00AA00;">:</span> cyan<span style="color: #00AA00;">;</span>
fill-opacity<span style="color: #00AA00;">:</span> .85<span style="color: #00AA00;">;</span>
stroke<span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#012</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/* Don't fill in SVG */</span>
<span style="color: #6666ff;">.layer</span> path<span style="color: #00AA00;">:</span>not<span style="color: #00AA00;">&#40;</span><span style="color: #00AA00;">&#91;</span>d$<span style="color: #00AA00;">=</span><span style="color: #ff0000;">&quot;Z&quot;</span><span style="color: #00AA00;">&#93;</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">&#123;</span>
fill<span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
stroke-<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">3px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>I wonder if there is a better way&#8230;</p>
<p>This story continues with: <a href="http://www.itopen.it/2012/01/09/tilestache-django-tiny-wrapper/">TileStache Django tiny wrapper</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itopen.it/2012/01/05/polymaps-tilestache-and-svg-css-styling-issues/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Il nuovo componente Joomla! GeoContent</title>
		<link>http://www.itopen.it/2011/09/09/geocontent-joomla-component/</link>
		<comments>http://www.itopen.it/2011/09/09/geocontent-joomla-component/#comments</comments>
		<pubDate>Fri, 09 Sep 2011 09:47:34 +0000</pubDate>
		<dc:creator>Alessandro Pasotti</dc:creator>
				<category><![CDATA[GIS]]></category>
		<category><![CDATA[Joomla]]></category>
		<category><![CDATA[WebGis]]></category>

		<guid isPermaLink="false">http://www.itopen.it/?p=564</guid>
		<description><![CDATA[GeoContent è un componente per Joomla! 1.7 e 2.5 che permette di inserire mappe di Google o OpenLayers nelle pagine del sito. Le mappe possono essere facilmente personalizzate e gli articoli possono essere georeferenziati per costruire un indice geografico del sito.]]></description>
			<content:encoded><![CDATA[<p><object><form action="https://www.paypal.com/cgi-bin/webscr" method="post"><input type="hidden" name="cmd" value="_xclick" /><input type="hidden" name="business" value="apasotti@gmail.com" /><input type="hidden" name="item_name" value="GeoContentPlus - Joomla 1.7+ Component" /><input type="hidden" name="amount" value="45" /><input type="hidden" name="currency_code" value="EUR" /><input type="hidden" name="item_number" value="4" /><input type="hidden" name="notify_url" value="http://www.itopen.it/wp-content/plugins/wp-cart-for-digital-products/paypal.php" /><input type="hidden" name="return" value="http://www.itopen.it/ppipn/thank-you.php" /><input type="hidden" name="mrb" value="3FWGC6LFTMTUG" /><input type="hidden" name="cbt" value="" /><input type="hidden" name="custom" value="" id="eStore_custom_values" /><input type="image" src="https://www.paypal.com/en_US/IT/i/btn/btn_buynowCC_LG.gif" class="eStore_buy_now_button" alt="Buy Now"/></form></object></p>
<div id="attachment_568" class="wp-caption alignright" style="width: 310px"><img class="size-full wp-image-568" title="geocontent_plus_banner_black_shadow" src="http://www.itopen.it/wp-content/uploads/2011/09/geocontent_plus_banner_black_shadow-e1315562139531.png" alt="" width="300" height="84" /><p class="wp-caption-text">GeoContent Plus Logo</p></div>
<div><img title="joomla_17" src="http://www.itopen.it/wp-content/uploads/2011/09/joomla_17.png" alt="" width="75" height="16" /> <img class="" title="joomla_25" src="http://www.itopen.it/wp-content/uploads/2011/09/joomla_25.png" alt="" width="75" height="16" /> native!</div>
<p><a class="rounded button" href="http://www.itopen.it/geocontent_plus_docs/">Browse GeoContent Plus documentation!</a></p>
<p><a class="rounded button" href="http://joomla2.studioarborea.it/">Try GeoContent Plus demo!</a></p>
<p>If you are looking for the old GeoContent version for Joomla! 1.5, please check the <a title="GeoContent: a new Google Maps Joomla! component" href="http://www.itopen.it/2009/05/11/geocontent-a-new-google-maps-joomla-component/">original announce</a>.</p>
<h2>Introduction</h2>
<div id="attachment_621" class="wp-caption alignright" style="width: 310px"><img class="alignright size-medium wp-image-621" title="gc_map" src="http://www.itopen.it/wp-content/uploads/2011/09/geocontent_olmap-300x197.png" alt="" width="300" height="197" /><p class="wp-caption-text">The Map</p></div>
<p>GeoContent Plus is a <strong>Joomla!</strong> 1.7.x and 2.5.x component that let you easily embed beautiful <strong>Google Maps</strong> or <strong>OpenLayers Maps</strong> into your <strong>Joomla!</strong> 1.7.x and 2.5.x website.</p>
<p>Standard <strong>Joomla!</strong> articles, can be bound to geographic features such as <em>POINTs</em>, <em>LINEs</em> and <em>POLYGONs</em> and the resulting maps can be shown in the article page and in one or more overview maps.</p>
<p>A single <strong>GeoContent Item</strong> can be represented by more than one geographic type: so that you can have simultaneously a set of POINTS, some POLYGONS and some LINES for a single <strong>Joomla!</strong> article.</p>
<p><strong>GeoContent Items</strong> on the map are grouped by <strong>GeoContent Layers</strong>, graphic appearance of <strong>GeoContent Items</strong> can be fully customized defining styles attributes in the <strong>GeoContent Layers</strong> configuration panel.</p>
<p><strong>GeoContent Plus</strong> was created as a sort of <em>Geographic Index</em> to <strong>Joomla!</strong> articles, the earliest versions had a tight binding between <strong>Joomla!</strong> articles and the geometric features that <strong>GeoContent Plus</strong> was going to show on its maps. Suggestion from the users made <strong>GeoContent Plus</strong> subsequently evolve to cover more general use cases, it is now possible to create<strong>GeoContent Items</strong> which are completely unbound from existing <strong>Joomla!</strong> articles.</p>
<div id="attachment_569" class="wp-caption alignright" style="width: 310px"><img class="alignright size-medium wp-image-621" title="gc_fe_mapeditor" src="http://www.itopen.it/wp-content/uploads/2011/09/gc_fe_mapeditor-300x252.png" alt="" width="300" height="252" /><p class="wp-caption-text">The Front-End editor window</p></div>
<p>The new Access Control List (ACL) features introduced by <strong>Joomla!</strong> 1.6 are now fully supported by <strong>GeoContent Plus</strong> allowing a fine grained control over the front-end and back-end user access to the different operations available in the software.</p>
<p><strong>GeoContent Items</strong> are also language-aware: they can optionally make use of the same <strong>Joomla!</strong> language support system recently introduced for <strong>Joomla!</strong> core articles.</p>
<h2>Download</h2>
<p><strong>ComGeocontent</strong> is <strong>open source software</strong>, distributed under <a title="AGPL Licence Text" href="http://www.fsf.org/licensing/licenses/agpl-3.0.html" target="_blank"><strong>AGPL</strong></a> software license and it is also <a title="Wikipedia Free Software page" href="http://en.wikipedia.org/wiki/Free_software" target="_blank"><strong>free software</strong></a>, where “free” means that you can do (almost) whatever you want with this software but it does not mean that it costs nothing. We distribute the component only in bundle with paid 12 month support service that costs <strong>45 €</strong>.</p>
<p>To receive a copy of <strong>GeoContent</strong> you are kindly requested to pay us <strong>45 €</strong>, using the buttons located at the top or at the bottom of this page. You will receive a regular invoice at the end of the month. After a successful payment,  an email with the download link will be automatically sent to you PayPal&#8217;s account email address.</p>
<p>The money you pay will be used to further develop <strong>GeoContent</strong> and to provide professional assistance and support to those that will need it.</p>
<p>Together with 12 months support you will get lifetime software updates, that means that you can pay just once and use the software forever in how many Joomla installations you like.</p>
<p>Please use the <strong>PayPal</strong> link at the top of this page, specifying the email where the component will be sent.</p>
<p>Thank you for supporting <strong>GeoContent</strong> project!</p>
<p><span class="Apple-style-span" style="font-size: 20px; font-weight: bold;">Key features</span></p>
<div id="key-features">
<p>What makes this component unique among other mapping tools in the <strong>Joomla!</strong> galaxy is probably the level of assistance (this is really what people pays for), its ease of use, its configurability and and its Import/Export functions.</p>
<div id="import-export">
<h3>Import/Export</h3>
<p>Input functions allows you to import tracks from a <em>GPX</em> file or directly draw into a map window within your browser, all your data will also be readily available in <em>KML</em> format.</p>
</div>
<div id="place-your-maps-anywhere">
<h3>Place your maps anywhere</h3>
<p>With the <strong>GeoContent Plus</strong> core output you can place your <strong>GeoContent Plus</strong> maps in one or more pages choosing one of the available <a href="http://www.itopen.it/geocontent_plus_docs/map_renderers.html#map-renderers"><em>Map renderers</em></a>. Using <a href="http://www.itopen.it/geocontent_plus_docs/plugins.html#plugins"><em>Plugins</em></a> you can also place customized <a href="http://www.itopen.it/geocontent_plus_docs/maps.html#tag-maps"><em>Tag maps</em></a> everywhere in an article or get the map inserted automatically in all articles where a linked <strong>GeoContent Item</strong> exists.</p>
</div>
<div id="styles-more">
<h3>Styles &amp; more</h3>
<p>From the control panel interface you can configure the appearance in details:</p>
<p>for each <strong>GeoContent Layer</strong>, you can style:</p>
<ul>
<li>Line color</li>
<li>Line width</li>
<li>Polygon line color</li>
<li>Polygon fill color</li>
<li>Polygon line transparency</li>
<li>Polygon fill transparency</li>
<li>Point icon</li>
<li>Point icon size (<strong>OpenLayers Maps</strong>, <strong>Olwidget Maps</strong> and KML only: not supported in the embedded <strong>Google Maps</strong>)</li>
</ul>
<p>Of course you can configure several aspects of the main map appearance:</p>
<ul>
<li><strong>Table of Contents</strong> (TOC) type (hidden, list, select)</li>
<li>TOC position (left, top, right, bottom)</li>
<li>TOC and main map width (onyl useful for TOC position left and right)</li>
<li>Which layers should be activated at start (none, all, selected)</li>
<li>Map dimensions</li>
<li>KML icon (hide or show)</li>
</ul>
<p><strong>OpenLayers</strong> based maps (<strong>OpenLayers Maps</strong> and <strong>Olwidget Maps</strong>) supports more styling feature:</p>
<ul>
<li>Labels for features (you can choose, font, color and transparency)</li>
<li>Clustering for points (<strong>Olwidget Maps</strong> only: points which are closer than 20px at the current visualisation scale are grouped)</li>
<li>Selection style: selected items (when the user clicks on an item) are styled differently</li>
</ul>
</div>
<div id="geocoding">
<h3>Geocoding</h3>
<p><a href="http://www.itopen.it/geocontent_plus_docs/modules.html#geocoding"><em>Geocoding module</em></a> allows the user to enter an address in a form field and get either redirected to a page of your site containing a <strong>GeoContent Plus</strong> map or get the existing map in the page (if any) centered and zoomed on the address coordinates.</p>
<p>This module is quite flexible and allows some nice tricks.</p>
</div>
</div>
<div id="map-types">
<h2>Map types</h2>
<p><strong>GeoContent Plus</strong> can produce different kind of maps, allowing a broad range of use cases.</p>
<div id="overview-maps">
<h3>Overview maps</h3>
<p>An <a href="http://www.itopen.it/geocontent_plus_docs/maps.html#overview-maps"><em>Overview Map</em></a> can be used as a <em>geographic index</em> to your <strong>Joomla!</strong> contents (articles or other <strong>Joomla!</strong> elements), this kind of map is typically used as a primary or secondary home page to show how website’s contents are positioned on the globe.</p>
</div>
<div id="automatic-maps">
<h3>Automatic maps</h3>
<p>An <em>automatic map</em> is generated by a <strong>Joomla!</strong> <a href="http://www.itopen.it/geocontent_plus_docs/plugins.html#content-plugin"><em>Content plugin</em></a> which automatically adds a map to an article’s page if the article has an associated <strong>GeoContent Item</strong>.</p>
</div>
<div id="tag-maps">
<h3>Tag maps</h3>
<p>Tags maps are the most flexible type of map: they are inserted by a <strong>Joomla!</strong> <a href="http://www.itopen.it/geocontent_plus_docs/plugins.html#content-plugin"><em>Content plugin</em></a> which replaces the <cite>{geocontent}</cite>string when found in an article’s body.</p>
<p>Tags maps can be configured in depth to show or not to show the <strong>Table of Contents</strong> or certain layers.</p>
</div>
</div>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itopen.it/2011/09/09/geocontent-joomla-component/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>QGIS mapserver test drive</title>
		<link>http://www.itopen.it/2011/04/20/qgis-mapserver-test-drive/</link>
		<comments>http://www.itopen.it/2011/04/20/qgis-mapserver-test-drive/#comments</comments>
		<pubDate>Wed, 20 Apr 2011 13:34:41 +0000</pubDate>
		<dc:creator>Alessandro Pasotti</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[WebGis]]></category>

		<guid isPermaLink="false">http://www.itopen.it/?p=522</guid>
		<description><![CDATA[QGIS recently added new WMS server capabilities to its software stack. Breaking into the server world, the new server can read a QGIS project project file and serve maps to the internet. This amazing new feature, really opens QGIS users to a new horizon of possibilities. ]]></description>
			<content:encoded><![CDATA[<div id="attachment_292" class="wp-caption alignright" style="width: 193px"><a href="http://www.itopen.it/wp-content/uploads/2009/06/qgis_logo_right.gif"><img class="size-full wp-image-292" title="qgis_logo_right" src="http://www.itopen.it/wp-content/uploads/2009/06/qgis_logo_right.gif" alt="" width="183" height="149" /></a><p class="wp-caption-text">QGIS logo</p></div>
<p>Today I found some time to test some new amazing QGIS features. One of the most interesting additions is the WMS integrated server.</p>
<p>I usually test all new projects in my user directory, I created a folder &#8216;~/public_html/qgis-client/&#8217; to host this test.</p>
<p>Next step was to enable CGI handling, since I run apache under Linux and all I had to do was to create a file named &#8216;.htaccess&#8217; in the &#8216;~/public_html&#8217; folder:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">AddHandler cgi-script .fcgi .cgi
Options +ExecCGI
SetEnv LD_LIBRARY_PATH <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>myuser<span style="color: #000000; font-weight: bold;">/</span>app<span style="color: #000000; font-weight: bold;">/</span>lib</pre></div></div>

<p>This few lines, enable CGI and add a search path to the library loader, this was necessary for the handler to load my QGIS trunk build, located in &#8216;~/app/&#8217;.</p>
<p>Now I needed to symlink the qgis-mapserv.fcgi executable into the project folder:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> ~<span style="color: #000000; font-weight: bold;">/</span>public_html<span style="color: #000000; font-weight: bold;">/</span>qgis-client<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> ~<span style="color: #000000; font-weight: bold;">/</span>app<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>qgis_mapserv.fcgi .
~<span style="color: #000000; font-weight: bold;">/</span>app<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>wms_metadata.xml .
<span style="color: #c20cb9; font-weight: bold;">vim</span> ~<span style="color: #000000; font-weight: bold;">/</span>app<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>wms_metadata.xml</pre></div></div>

<p>The last command allows the customization of the GetCapabilities response.</p>
<p>I was now able to serve a qgis project with the WMS protocol, the project location can be specified with the map parameter, like this:</p>
<pre>http://localhost/~myuser/qgis-client/qgis_mapserv.fcgi?map=/home/ale/public_html/qgis-client/qgis-client.qgs</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.itopen.it/2011/04/20/qgis-mapserver-test-drive/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Italian GFOSS Day 2010</title>
		<link>http://www.itopen.it/2010/11/12/italian-gfoss-day-2010/</link>
		<comments>http://www.itopen.it/2010/11/12/italian-gfoss-day-2010/#comments</comments>
		<pubDate>Fri, 12 Nov 2010 16:48:10 +0000</pubDate>
		<dc:creator>Alessandro Pasotti</dc:creator>
				<category><![CDATA[GIS]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[WebGis]]></category>

		<guid isPermaLink="false">http://www.itopen.it/?p=464</guid>
		<description><![CDATA[Next week, from wednesday 18 to friday 19, I will attend in Foligno to the upcoming GFOSS Day 2010 holding two tutorials on GIS Python development and on a GeoDjango case study. Like previous editions of this event, it will be another fundamental opportunity to meet the other members of the Italian free GIS software community. Don't miss this event, if you can!]]></description>
			<content:encoded><![CDATA[<h1><a href="http://www.itopen.it/wp-content/uploads/2010/11/gfoss_logo.png"><img class="alignright size-medium wp-image-467" title="gfoss_logo" src="http://www.itopen.it/wp-content/uploads/2010/11/gfoss_logo-300x100.png" alt="" width="300" height="100" /></a>About GFOSS:</h1>
<p><a title="GFOSS official site" href="http://www.gfoss.it" target="_blank">GFOSS</a> is the Italian chapter of <a title="OSGEO website" href="http://www.osgeo.org" target="_blank">OSGEO</a> fundation.</p>
<p>I am a proud member from its birth and I participate to almost all events.</p>
<h1>About GFOSS Day:</h1>
<p>GFOSS day is an yearly meeting where all the people interested in geographic open source free sotware can meet to share ideas and experiences.</p>
<p>This year 2010  the event will last two days (18 and 19 november) with conferences, tutorials and workshops.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itopen.it/2010/11/12/italian-gfoss-day-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux Day 2007 a Cinisello Balsamo, GIS e WebGIS</title>
		<link>http://www.itopen.it/2007/10/31/gis-and-webgis-at-linux-day-2007/</link>
		<comments>http://www.itopen.it/2007/10/31/gis-and-webgis-at-linux-day-2007/#comments</comments>
		<pubDate>Wed, 31 Oct 2007 20:12:43 +0000</pubDate>
		<dc:creator>Alessandro Pasotti</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mapserver e mapscript]]></category>
		<category><![CDATA[WebGis]]></category>

		<guid isPermaLink="false">http://www.itopen.it/2007/10/31/gis-and-webgis-at-linux-day-2007/</guid>
		<description><![CDATA[Buona la partecipazione e ottimo il livello dei talk al Linux day 2007 organizzato a Cinisello Balsamo. Abbiamo partecipato direttamente come associazione GFOSS per l&#8217;informatica geografica libera all&#8217;incontro sui sistemi informativi territoriali con una presentazione sulle applicazioni di web mapping e sull&#8217;interoperabilità dei servizi webgis. Potete scaricare le slide del mio intervento a questo indirizzo: [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.itopen.it/wp-content/uploads/2007/10/logo_linuxdayd07.png" alt="Logo Linux Day 2007" align="right" />Buona la partecipazione e ottimo il livello dei talk al Linux day 2007 organizzato a Cinisello Balsamo.</p>
<p>Abbiamo partecipato direttamente come associazione <a href="http://www.gfoss.it" title="Associazione GFOSS per l'informatica geografica libera">GFOSS</a> per l&#8217;informatica geografica libera all&#8217;incontro sui sistemi informativi territoriali con una  presentazione sulle applicazioni di web mapping e sull&#8217;interoperabilità dei servizi webgis.</p>
<p>Potete scaricare le slide del mio intervento a questo indirizzo:</p>
<p><a href="http://www.itopen.it/wp-content/uploads/2007/10/liux-day-2007.pdf" title="Slide linux day 2007">Slide linux day 2007</a></p>
<p><a href="http://www.itopen.it/wp-content/uploads/2007/10/hpim4558_small.png" title="Presentazione WEBGIS Parco Nord Milano al Linux day 2007"><img src="http://www.itopen.it/wp-content/uploads/2007/10/hpim4558_small.thumbnail.png" alt="Presentazione WEBGIS Parco Nord Milano al Linux day 2007" align="left" /></a>Interessantissime novità anche dal punto di vista della certificazione, da poco, grazie al lavoro di Marina Cabrini e Andrea Giacomelli nonché di diversi membri della comunità GFOSS, è possibile ottenere al certificazione GIS ECDL riconosciuta a livello europeo utilizzando solo software libero. Un altro importante traguardo è stato raggiunto!</p>
<p>Maurizio Napolitano ha presentato l&#8217;esperienza <a href="http://webvalley.itc.it/content/view/19/45/" title="Web Valley">Web Valley</a> , una iniziativa decisamente interessante di didattica basata sull&#8217;informazione geografica e sul software libero.</p>
<p>Un sincero ringraziamento a tutti i relatori, gli organizzatori e  i partecipanti di questa bella giornata.</p>
<p>Arrivederci al Linux Day 2008!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itopen.it/2007/10/31/gis-and-webgis-at-linux-day-2007/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Compressione JS in p.mapper</title>
		<link>http://www.itopen.it/2007/10/23/compressione-js-in-pmapper/</link>
		<comments>http://www.itopen.it/2007/10/23/compressione-js-in-pmapper/#comments</comments>
		<pubDate>Tue, 23 Oct 2007 16:50:20 +0000</pubDate>
		<dc:creator>Alessandro Pasotti</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[WebGis]]></category>

		<guid isPermaLink="false">http://www.itopen.it/2007/10/23/compressione-js-in-pmapper/</guid>
		<description><![CDATA[
Questa breve nota (disponibile solo in inglese) descrive come migliorare significativamente i tempi di caricamento di p.mapper tramite la compressione dei file JavaScript di questo ottimo client WebGIS.

]]></description>
			<content:encoded><![CDATA[<p>Articolo disponibile solo in inglese: scegliere la lingua tramite le bandierine in alto.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itopen.it/2007/10/23/compressione-js-in-pmapper/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A restful service for mapfile configuration</title>
		<link>http://www.itopen.it/2007/10/05/a-restful-service-for-mapfile-configuration/</link>
		<comments>http://www.itopen.it/2007/10/05/a-restful-service-for-mapfile-configuration/#comments</comments>
		<pubDate>Fri, 05 Oct 2007 07:15:00 +0000</pubDate>
		<dc:creator>Alessandro Pasotti</dc:creator>
				<category><![CDATA[Mapserver e mapscript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WebGis]]></category>

		<guid isPermaLink="false">http://www.itopen.it/2007/10/05/a-restful-service-for-mapfile-configuration/</guid>
		<description><![CDATA[
Questo articolo è disponibile solo in inglese (fate clic sulla bandierina in alto per visualizzare il contenuto).
]]></description>
			<content:encoded><![CDATA[<p>Recently, we&#8217;ve been actively working on a restful mapfile configuration service.</p>
<p>The advantages of such a system are those of typical webservice:</p>
<ul>
<li>fully decoupled from the GUI, the GUI could be written in any language that talks REST</li>
<li>plain text mapfiles as the storage system</li>
</ul>
<p>The service is being written in PHP and the RESTFUL part is managed with PHP Tonic library.</p>
<p>A few examples of typical URLs:</p>
<ul>
<li>GET http://www.mymaps.com/maps &#8211; retrieve a list of mapfiles</li>
<li>POST http://www.mymaps.com/maps &#8211; creates a new mapfile with the JSON data passed on post</li>
<li>GET http://www.mymaps.com/maps/my_first_map.json &#8211; retrieve the map data as JSON</li>
<li>GET http://www.mymaps.com/maps/my_first_map.xml &#8211; retrieve the map data as XML</li>
<li>GET http://www.mymaps.com/maps/my_first_map.map &#8211; retrieve the map data as plain text mapfile</li>
<li>PUT http://www.mymaps.com/maps/my_first_map.json &#8211; alter the map with JSON data</li>
<li>PUT http://www.mymaps.com/maps/my_first_map.xml &#8211; alter the map with XML data</li>
<li>GET http://www.mymaps.com/maps/my_first_map.xml/layers &#8211; retrieve the map layers as XML</li>
<li>GET http://www.mymaps.com/maps/my_first_map.xml/layers/my_first_layer &#8211; retrieve the map layer data as XML</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.itopen.it/2007/10/05/a-restful-service-for-mapfile-configuration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

