<?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 - Open Web Solutions, WebGis Development &#187; GIS</title>
	<atom:link href="http://www.itopen.it/category/gis/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>QGIS Zuerich hackmeeting</title>
		<link>http://www.itopen.it/2011/12/16/meeting-di-programmatori-qgis-a-zurigo/</link>
		<comments>http://www.itopen.it/2011/12/16/meeting-di-programmatori-qgis-a-zurigo/#comments</comments>
		<pubDate>Fri, 16 Dec 2011 15:45:29 +0000</pubDate>
		<dc:creator>Alessandro Pasotti</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[GIS]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.itopen.it/?p=675</guid>
		<description><![CDATA[Last november I participated to the international QGIS programmer&#8217;s meeting in Zuerich. It was a great opportunity to meet the QGIS developers I already knew from the previous meeting in Lisbon, and to know new interesting people. QGIS is quickly becoming one of the most important free software packages for GIS processing, I participate to [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_676" class="wp-caption alignright" style="width: 310px"><a href="http://www.itopen.it/wp-content/uploads/2011/12/foto-gruppo-zurigo.jpg"><img class="size-medium wp-image-676" title="foto-gruppo-zurigo" src="http://www.itopen.it/wp-content/uploads/2011/12/foto-gruppo-zurigo-300x123.jpg" alt="" width="300" height="123" /></a><p class="wp-caption-text">Zuerich QGIS hackmeeting</p></div>
<p>Last november I participated to the international <a href="http://www.qgis.org" target="_blank">QGIS</a> programmer&#8217;s meeting in Zuerich. It was a great opportunity to meet the QGIS developers I already knew from the previous meeting in Lisbon, and to know new interesting people.</p>
<p>QGIS is quickly becoming one of the most important free software packages for GIS processing, I participate to the team as the lead developer of the new python plugins web application, realized with the <a title="Django Framework project" href="https://www.djangoproject.com/" target="_blank">Django</a> framework.</p>
<p>During the meeting I worked on fixing bugs and I implemented some new features the most important being the new XML-RPC interface that allows to programmatically upload plugins.</p>
<p>The newXML-RPC  interface has been realized with <a title="RPC4Django home page" href="http://davidfischer.name/rpc4django/" target="_blank">RPC4Django</a>, a cool package that allows for quick webservice creation in Django.</p>
<p>Looking forward to the next hackmeeting in France I wish to thank the <a href="http://www.gfoss.it" target="_blank">Italian Geographic Free Open-Source Software Association</a> for the financial aids provided.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itopen.it/2011/12/16/meeting-di-programmatori-qgis-a-zurigo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenStreeetMap and OpenCycleMap extent bookmarklet</title>
		<link>http://www.itopen.it/2011/11/24/openstreeetmap-and-opencyclemap-extent-bookmarklet/</link>
		<comments>http://www.itopen.it/2011/11/24/openstreeetmap-and-opencyclemap-extent-bookmarklet/#comments</comments>
		<pubDate>Thu, 24 Nov 2011 13:42:40 +0000</pubDate>
		<dc:creator>Alessandro Pasotti</dc:creator>
				<category><![CDATA[GIS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Tech]]></category>

		<guid isPermaLink="false">http://www.itopen.it/?p=636</guid>
		<description><![CDATA[Today I wrote a simple bookmarklet to get the map extent in EPSG:4326 from the wonderful OpenCycleMaps.org website. It also works on the OpenStreetMap.org website. You can just right-click and save it on your bookmarks, the click on the bookmark while in the OpenCycleMap site and a popup will appear with the extent coordinates printed [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-full wp-image-637" title="map_extent_bookmarklet" src="http://www.itopen.it/wp-content/uploads/2011/11/map_extent_bookmarklet.png" alt="" width="321" height="133" />Today I wrote a simple bookmarklet to get the map extent in EPSG:4326 from the wonderful <a title="Open Cycle Maps Website" href="http://www.opencyclemap.org">OpenCycleMaps.org</a> website. It also works on the OpenStreetMap.org website.</p>
<p>You can just right-click and save it on your bookmarks, the click on the bookmark while in the OpenCycleMap site and a popup will appear with the extent coordinates printed on screen.</p>
<p><a title="MapExtent" href="javascript:b=map.getExtent().transform(map.getProjectionObject(),%20new%20OpenLayers.Projection('EPSG:4326'));alert('Extent:%20'+b.left+'%20'+b.bottom+'%20'+b.right+'%20'+b.top);">Bookmarklet</a>.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itopen.it/2011/11/24/openstreeetmap-and-opencyclemap-extent-bookmarklet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GeoExt debug build</title>
		<link>http://www.itopen.it/2011/11/08/geoext-debug-build/</link>
		<comments>http://www.itopen.it/2011/11/08/geoext-debug-build/#comments</comments>
		<pubDate>Tue, 08 Nov 2011 18:26:02 +0000</pubDate>
		<dc:creator>Alessandro Pasotti</dc:creator>
				<category><![CDATA[GeoExt]]></category>
		<category><![CDATA[GIS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Tech]]></category>

		<guid isPermaLink="false">http://www.itopen.it/?p=630</guid>
		<description><![CDATA[How to build an uncompressed debug version of GeoExt.]]></description>
			<content:encoded><![CDATA[<p>After struggling for a while with a nasty bug in my<a title="GeoExt website" href="http://geoext.org/" target="_blank"> GeoExt</a>-based code, I&#8217;ve managed to build an uncompressed version.</p>
<p>Strangely enough there is no way to download an uncompressed version from the project website, even if they provide a nice custom build form.</p>
<p>The recommended way is to use &#8220;<a title="JsBuild website" href="http://jsbuild.kodfabrik.com/" target="_blank">jsbuild</a>&#8220;, which turned to be a nightmare because it does not run out-of-the-box, at least on my Ubuntu lucid.</p>
<p>A one-liner did the trick, run it from a &#8220;build&#8221; folder under GeoExt main folder, the correct order of inclusion (which does really matter) is taken from the &#8220;single&#8221; file GeoExt.js.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">for</span> f <span style="color: #000000; font-weight: bold;">in</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">egrep</span> <span style="color: #ff0000;">'&quot;GeoExt/'</span> ..<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>GeoExt.js<span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">'s/&quot;//g'</span><span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">'s/,//g'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> ; <span style="color: #000000; font-weight: bold;">do</span> <span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #ff0000;">&quot;../lib/<span style="color: #007800;">$f</span>&quot;</span> ; <span style="color: #000000; font-weight: bold;">done</span> <span style="color: #000000; font-weight: bold;">&gt;</span> GeoExt-debug.js</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.itopen.it/2011/11/08/geoext-debug-build/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GeoContent Joomla component ready for 1.7, 2.5 and newer</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[<strong>GeoContent Plus</strong> 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>GeoContent gives a geographical dimension to your Joomla! website.</p>]]></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 hackmeeting 2011</title>
		<link>http://www.itopen.it/2011/04/29/qgis-hackmeeting-2011/</link>
		<comments>http://www.itopen.it/2011/04/29/qgis-hackmeeting-2011/#comments</comments>
		<pubDate>Fri, 29 Apr 2011 13:58:22 +0000</pubDate>
		<dc:creator>Alessandro Pasotti</dc:creator>
				<category><![CDATA[GIS]]></category>
		<category><![CDATA[Programmazione]]></category>

		<guid isPermaLink="false">http://www.itopen.it/?p=533</guid>
		<description><![CDATA[Last week I participated to the QGIS hackfest in Lisbon. It was a wonderful opportunity to meet a lot of interesting people, most of whom I&#8217;ve only known by email or chat. I was also very happy to meet Tim Sutton, release manager of QGIS, I&#8217;ve spent two month within a project with him without [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_292" class="wp-caption alignright" style="width: 160px"><a href="http://www.itopen.it/wp-content/uploads/2009/06/qgis_logo_right.gif"><img class="size-thumbnail wp-image-292" title="qgis_logo_right" src="http://www.itopen.it/wp-content/uploads/2009/06/qgis_logo_right-150x149.gif" alt="" width="150" height="149" /></a><p class="wp-caption-text">QGIS logo</p></div>
<p>Last week I participated to the QGIS hackfest in Lisbon. It was a wonderful opportunity to meet a lot of interesting people, most of whom I&#8217;ve only known by email or chat.</p>
<p><span id="more-533"></span>I was also very happy to meet Tim Sutton, release manager of QGIS, I&#8217;ve spent two month within a project with him without having ever meet in person.<br />
The meeting has been carefully organised by Giovanni Manghi and Vania Nieves, both from Faunalia PT. The faculty of letters in the university of Lisbon was the location of the meeting, a nice place to stay, just a little bit too warm in these days.<br />
The atmosphere was that of a friend&#8217;s meeting, informal but very professional when discussing the future plans of the QGIS platform: most of the developers are not working full time on QGIS but the concentration of talented professionals in the room was really impressive.</p>
<p>My role in the story is related to the periferic functions of the new python plugins web application: I&#8217;ve been the main developer of that application, it is based on Django, the platform I&#8217;m working on since two years now. I&#8217;ve been lucky and in Lisbon I met two very skilled young developers which demonstrated a strong interest in helping out with polishing and completing the application. So, thanks to Richard and Ricardo (this is their name) the new QGIS web application will hopefully grow quickly and with a lot of new cool features.</p>
<p>The conclusion is that this Lisbon hackfest has been a very intensive and interesting meeting, I really hope that I will be able to participate at the next one, that will take place in Zurich next fall</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itopen.it/2011/04/29/qgis-hackmeeting-2011/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Right click map control in OpenLayers</title>
		<link>http://www.itopen.it/2011/01/11/right-click-map-control-in-openlayers/</link>
		<comments>http://www.itopen.it/2011/01/11/right-click-map-control-in-openlayers/#comments</comments>
		<pubDate>Tue, 11 Jan 2011 12:39:59 +0000</pubDate>
		<dc:creator>Alessandro Pasotti</dc:creator>
				<category><![CDATA[GIS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Tech]]></category>

		<guid isPermaLink="false">http://www.itopen.it/?p=493</guid>
		<description><![CDATA[Thanks to a post in Spatial Notes Blog I&#8217;ve finally found a cross-browser way to handle right click on an OL map, I&#8217;ve been using an homebrew solution only to discover how it did not work correctly in MSIE. The proposed solution involves a custom control subclass and the standard OL machinery, the MSIE oddities [...]]]></description>
			<content:encoded><![CDATA[<p>Thanks to a post in <a href="http://spatialnotes.blogspot.com/2010/11/capturing-right-click-events-in.html">Spatial Notes Blog</a> I&#8217;ve finally found a cross-browser way to handle right click on an OL map, I&#8217;ve been using an homebrew solution only to discover how it did not work correctly in MSIE.</p>
<p>The proposed solution involves a custom control subclass and the standard OL machinery, the MSIE oddities are handled internally by OL itself.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itopen.it/2011/01/11/right-click-map-control-in-openlayers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

