<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   >
<channel>
    
    <title>BostonGIS - spatialite</title>
    <link>https://www.bostongis.com/blog/</link>
    <description>Open Source GIS</description>
    <dc:language>en</dc:language>
    <generator>Serendipity 2.6.0 - http://www.s9y.org/</generator>
    <pubDate>Thu, 09 May 2013 12:39:56 GMT</pubDate>

    <image>
    <url>https://www.bostongis.com/blog/templates/default/img/s9y_banner_small.png</url>
    <title>RSS: BostonGIS - spatialite - Open Source GIS</title>
    <link>https://www.bostongis.com/blog/</link>
    <width>100</width>
    <height>21</height>
</image>

<item>
    <title>Chopping rasters with gdal_translate</title>
    <link>https://www.bostongis.com/blog/index.php?/archives/218-Chopping-rasters-with-gdal_translate.html</link>
            <category>gdal</category>
            <category>gis</category>
            <category>postgis_raster</category>
            <category>spatialite</category>
            <category>waiting_postgis_21</category>
    
    <comments>https://www.bostongis.com/blog/index.php?/archives/218-Chopping-rasters-with-gdal_translate.html#comments</comments>
    <wfw:comment>https://www.bostongis.com/blog/wfwcomment.php?cid=218</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>https://www.bostongis.com/blog/rss.php?version=2.0&amp;type=comments&amp;cid=218</wfw:commentRss>
    

    <author>nospam@example.com (Regina Obe)</author>
    <content:encoded>
    &lt;p&gt;We had this big raster that we needed to chop up into tiles and only extract a portion of for load into PostGIS.  raster2pgsql doesn&#039;t currently have an option to pull just a portion of a raster and also  we don&#039;t have the windows raster2pgsql compiled with MrSID support. Luckily
GDAL commandline gdal_translate has this switch that allows you to specify a chunk of a raster to grab based on a projected or unprojected box window.
We wanted to grab just that portion that is part of boston and chunk it into bite size pieces. What we needed was a grid generator similar to
what we described a while back in &lt;a href=&quot;https://www.bostongis.com/blog/index.php?/archives/35-Map-Dicing-and-other-stuff.html&quot; target=&quot;_blank&quot;&gt;Map Dicing and other stuff&lt;/a&gt;
that would chop our neighborhood into bite sized tiles we could then use to generate the relevant gdal_translate command.
Instead of using temp tables and all that stuff, we decided to try with the ST_Tile raster function.  Creating an empty raster and then tiling it.&lt;/p&gt;

&lt;div style=&#039;background-color:yellow&#039;&gt;Note the repurposing: Creating a raster with no bands to accomplish a task that has nothing to do with rasters, so that we can then apply it to something to do with rasters. Gridding is a surprisingly common step in a lot of spatial processing workflows.&lt;/p&gt;
&lt;p&gt;Here is the SQL to do it and we&#039;ll explain in a separate article in more detail.&lt;/div&gt;

&lt;p&gt;In a nutshell, we&#039;re using PostGIS raster technology (&lt;a href=&quot;http://postgis.net/docs/manual-dev/RT_ST_Tile.html&quot; target=&quot;_blank&quot;&gt;ST_Tile&lt;/a&gt; function introduced in PostGIS 2.1) that we demonstrated in &lt;a href=&quot;https://www.bostongis.com/blog/index.php?/archives/207-Waiting-for-PostGIS-2.1-ST_Tile.html&quot; target=&quot;_blank&quot;&gt;Waiting for PostGIS 2.1 ST_Tile&lt;/a&gt; to create a grid because PostGIS geometry doesn&#039;t have cool gridding function like SpatiaLite has :).
&lt;a href=&quot;https://www.gaia-gis.it/fossil/libspatialite/wiki?name=tesselations-4.0&quot; target=&quot;_blank&quot;&gt;SpatialLite tesselation&lt;/a&gt;.  Perhaps in PostGIS 2.2
we&#039;ll see some of these SpatiaLite niceties. However ST_Tile does the trick fairly nicely and quickly.  For this example took under 600 ms to generate 1524 rows of GDAL commands.&lt;/p&gt; &lt;a class=&quot;block_level&quot; href=&quot;https://www.bostongis.com/blog/index.php?/archives/218-Chopping-rasters-with-gdal_translate.html#extended&quot;&gt;Continue reading &quot;Chopping rasters with gdal_translate&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Thu, 09 May 2013 04:21:00 -0400</pubDate>
    <guid isPermaLink="false">https://www.bostongis.com/blog/index.php?/archives/218-guid.html</guid>
    
</item>

</channel>
</rss>
