<?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; Programmazione</title>
	<atom:link href="http://www.itopen.it/category/programmazione/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>Jupgrade: fixing migration errors</title>
		<link>http://www.itopen.it/2011/12/16/jupgrade-fixing-migration-errors/</link>
		<comments>http://www.itopen.it/2011/12/16/jupgrade-fixing-migration-errors/#comments</comments>
		<pubDate>Fri, 16 Dec 2011 14:29:55 +0000</pubDate>
		<dc:creator>Alessandro Pasotti</dc:creator>
				<category><![CDATA[Joomla]]></category>
		<category><![CDATA[Tech]]></category>

		<guid isPermaLink="false">http://www.itopen.it/?p=663</guid>
		<description><![CDATA[Last week I challenged my first migration from Joomla 1.5 to 1.7. Jupgrade is a wonderful tool, it worked pretty well but leaved the categories tree in an unuseable state and made a big mess in the article&#8217;s ACL. The symptoms of the two problems are: some categories (non only in articles but also in [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.itopen.it/wp-content/uploads/2007/10/joomlacolor.png"><img class="alignright  wp-image-148" title="Joomla logo quadrato" src="http://www.itopen.it/wp-content/uploads/2007/10/joomlacolor.png" alt="" width="192" height="192" /></a></p>
<p>Last week I challenged my first migration from Joomla 1.5 to 1.7. Jupgrade is a wonderful tool, it worked pretty well but leaved the categories tree in an unuseable state and made a big mess in the article&#8217;s ACL.</p>
<p>The symptoms of the two problems are:</p>
<ol>
<li>some categories (non only in articles but also in weblinks and contacts) are not shown in the articles category drop-down list, a category tree rebuild from the control panel doesn&#8217;t solve the problem</li>
<li>users of levels different than superadminstrator cannot edit and save articles created from other users, apparently the ACL should allow this because they are set to &#8220;inherit&#8221; and the action should be allowed by the upstream ACL.</li>
</ol>
<p>At first I managed to solve the tree problem with some SQL but this was not enough to solve the second issue: most articles (hundreds of them) still had wrong ACL set preventing administrator level users to edit or save other&#8217;s articles.</p>
<p>Opening and saving each single article when logged in as superadministrator solved the issue, but doing this boring procedure with hundreds of articles and having many other sites to migrate the most obvious solution was to write a small component to fix those issues.</p>
<p>The component performs two tasks:</p>
<ol>
<li>rebuild the category tree, assigning correct depth and parent</li>
<li>reset all category and article&#8217;s ACLs to default (inherited)</li>
</ol>
<p>No warranty and no assistance are available but if it helped you to solve a problem and to save time and money, a donation of any amount would be appreciated.</p>
<p>Download the component <a href="http://www.itopen.it/wp-content/uploads/2011/12/com_fixperm.zip">com_fixperm</a>.</p>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick" />
<input type="hidden" name="hosted_button_id" value="8ADZ9H2EKRQBU" />
<input type="image" name="submit" src="https://www.paypalobjects.com/it_IT/IT/i/btn/btn_donateCC_LG.gif" alt="PayPal - Il sistema di pagamento online più facile e sicuro!" /> <img src="https://www.paypalobjects.com/it_IT/i/scr/pixel.gif" alt="" width="1" height="1" border="0" /></form>
]]></content:encoded>
			<wfw:commentRss>http://www.itopen.it/2011/12/16/jupgrade-fixing-migration-errors/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Joomla FAP accessible template ready for 1.7</title>
		<link>http://www.itopen.it/2011/12/06/prima-versione-pubblica-di-joomla-fap-1-7/</link>
		<comments>http://www.itopen.it/2011/12/06/prima-versione-pubblica-di-joomla-fap-1-7/#comments</comments>
		<pubDate>Tue, 06 Dec 2011 18:05:55 +0000</pubDate>
		<dc:creator>Alessandro Pasotti</dc:creator>
				<category><![CDATA[Joomla]]></category>
		<category><![CDATA[[lang_it]Accessibilità[/lang_it][lang_en]Accessibility[/lang_en]]]></category>

		<guid isPermaLink="false">http://www.itopen.it/?p=643</guid>
		<description><![CDATA[Today I released the first public version of Jooma! FAP 1.7, the accessible suite for Joomla! which I&#8217;m developing since 2008. The suite was born to comply with the Italian regulation regarding web sites managed by public administrations, they must be not only accessible but also follow other technical requirements (like doctype XHTML 1.0 strict, [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-full wp-image-127" title="Joomla Logo" src="http://www.itopen.it/wp-content/uploads/2007/08/joomla300px.png" alt="" width="300" height="61" /><br />
Today I released the first public version of Jooma! FAP 1.7, the accessible suite for Joomla! which I&#8217;m developing since 2008.</p>
<p>The suite was born to comply with the Italian regulation regarding web sites managed by public administrations, they must be not only accessible but also follow other technical requirements (like doctype XHTML 1.0 strict, to say one).</p>
<p>The project is maintained on <a title="Github project page" href="https://github.com/elpaso/joomla-fap-17" target="_blank">github </a>, all the code is released under AGPL (Affero GPL) license.</p>
<div id="attachment_654" class="wp-caption alignright" style="width: 310px"><a href="http://www.itopen.it/wp-content/uploads/2011/12/joomla_fap_tpl_positions.png"><img class="size-medium wp-image-654" title="joomla_fap_tpl_positions" src="http://www.itopen.it/wp-content/uploads/2011/12/joomla_fap_tpl_positions-300x225.png" alt="Posizioni del template Joomla! FAP 1.7" width="300" height="225" /></a><p class="wp-caption-text">Posizioni del template Joomla! FAP 1.7</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.itopen.it/2011/12/06/prima-versione-pubblica-di-joomla-fap-1-7/feed/</wfw:commentRss>
		<slash:comments>2</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>Corso introduttivo Joomla! a pinerolo</title>
		<link>http://www.itopen.it/2011/09/20/corso-introduttivo-joomla-a-pinerolo/</link>
		<comments>http://www.itopen.it/2011/09/20/corso-introduttivo-joomla-a-pinerolo/#comments</comments>
		<pubDate>Tue, 20 Sep 2011 12:19:20 +0000</pubDate>
		<dc:creator>Alessandro Pasotti</dc:creator>
				<category><![CDATA[Joomla]]></category>

		<guid isPermaLink="false">http://www.itopen.it/?p=595</guid>
		<description><![CDATA[Un corso su Joomla! nell'ambito delle iniziative per il Linux Day 2011, organizzato dall'associazione SLiP (Software Libero Pinerolo).
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.itopen.it/wp-content/uploads/2007/10/joomlacolor.png"><img class="alignright size-full wp-image-148" title="Joomla logo quadrato" src="http://www.itopen.it/wp-content/uploads/2007/10/joomlacolor.png" alt="" width="218" height="218" /></a>SLiP (Software Libero Pinerolo) organizza un corso gratuito su Joomla!</p>
<p>Il corso, gratuito e aperto a tutti, si svolgerà in due incontri: sabato 8 ottobre 2011 e sabato 22 ottobre 2011 dalle 14:30 alle 17:30 presso il Centro Studi e Museo d&#8217;Arte Preistorica, via Brignone 9 a Pinerolo.</p>
<p>Il secondo incontro, del 22 ottobre, sarà inserito nell&#8217;ambito della programmazione dell&#8217;edizione pinerolese dell&#8217;evento nazionale &#8220;Linux Day 2011&#8243;, che si terrà il 22 ottobre 2011 dalle 9 alle 18, sempre presso il Museo.</p>
<p>Per informazioni e iscrizioni (i posti disponibili sono limitati), invia un messaggio email a</p>
<p>info@pinerolo.linux.it</p>
<p>Sito dell&#8217;associazione: <a href="http://www.pinerolo.linux.it">http://www.pinerolo.linux.it</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.itopen.it/2011/09/20/corso-introduttivo-joomla-a-pinerolo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

