Hi,<br><br>I noticed that the OSM data is using srid = 900913. So I reloaded the tif files as the same srid, yet <br>no luck with the intersection query! :( <br><b>ALTER TABLE public.planet_osm_line ADD COLUMN way geometry(LineString,900913);<br>
</b><br>Cheers,<br>Ed<br><div class="gmail_quote">On Mon, Feb 27, 2012 at 3:25 PM, Ed Linde <span dir="ltr"><<a href="mailto:edolinde@gmail.com">edolinde@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Pierre,<br>I used --> <b>/root/postgis-svn/raster/loader/raster2pgsql -s 4326 -t 50x50 -I *.tif public.srtm_tiled > elev.sql</b><br>for the loading. The switch in args did not make a difference unfortunately! :(<br>

I am pretty sure that the OSM roads geometry used SRID = 4326, and I think the arguments I have <br>used to get in the tif files with the -s option also is right. <br>One warning I got while loading was (maybe it makes sense to you?) :<br>

<br><b>/root/postgis-svn/raster/loader/raster2pgsql -s 4326 -t 50x50 -I *.tif public.srtm_tiled > elev.sql<br></b>Processing 1/4: srtm_38_01.tif<br>Processing 2/4: srtm_38_02.tif<br><b>WARNING: Different geotransform matrices found in the set of rasters being converted to PostGIS raster<br>

</b>Processing 3/4: srtm_39_01.tif<br>Processing 4/4: srtm_39_02.tif<br><br>I tried loading the rasters and the roads in qgis, but it didn't manage to show them together, so I am not sure why its<br>not aligning. I am sure its some sort of alignment issue, but do not see where its wrong. I am getting the SRTM files <br>

from <a href="http://gis-lab.info/data/srtm-tif/" target="_blank">http://gis-lab.info/data/srtm-tif/</a> <br>And the OSM road was just the map for Denmark on OSM --> <a href="http://download.geofabrik.de/osm/europe/" target="_blank">http://download.geofabrik.de/osm/europe/</a><br>

<br>Is it possible for you to intersect these? I understand you are the author of the postgis tutorial that I am trying to follow<br>to achieve the same...hence I ask. :)<br><br>Cheers,<br>Ed<div class="HOEnZb"><div class="h5">
<br><br><br><div class="gmail_quote">
On Mon, Feb 27, 2012 at 2:58 PM, Pierre Racine <span dir="ltr"><<a href="mailto:Pierre.Racine@sbf.ulaval.ca" target="_blank">Pierre.Racine@sbf.ulaval.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div><br>
<br>
> -----Original Message-----<br>
> From: <a href="mailto:postgis-users-bounces@postgis.refractions.net" target="_blank">postgis-users-bounces@postgis.refractions.net</a> [mailto:<a href="mailto:postgis-users-" target="_blank">postgis-users-</a><br>
> <a href="mailto:bounces@postgis.refractions.net" target="_blank">bounces@postgis.refractions.net</a>] On Behalf Of Ed Linde<br>
> Sent: Monday, February 27, 2012 7:21 AM<br>
> To: <a href="mailto:postgis-users@postgis.refractions.net" target="_blank">postgis-users@postgis.refractions.net</a><br>
> Subject: [postgis-users] Raster + Geometry Intersection<br>
><br>
> Hi,<br>
> I am trying to compute elevations for a road network that I have downloaded<br>
> and installed into my pg database using osm2pgsql. I also have loaded SRTM tif<br>
> files and they are stored as type RASTER in my table.<br>
> I am now trying to compute an intersection between the SRTM rasters and the<br>
> OSM road geometries... with no luck! :( I am following this tutorial --><br>
> <a href="http://trac.osgeo.org/postgis/wiki/WKTRasterTutorial01" target="_blank">http://trac.osgeo.org/postgis/wiki/WKTRasterTutorial01</a><br>
> but I think it might be slightly outdated.<br>
<br>
</div>The base queries to do the intersection are still valid. Only the uploading changed. And not much.<br>
<div><br>
>  SELECT o.osm_id,<br>
>         ST_Intersection(s.rast, o.way)<br>
>  FROM planet_osm_line o,<br>
>       srtm_tiled s<br>
>  WHERE ST_Intersects(s.rast, o.way);<br>
><br>
> way type -->   way geometry(LineString,900913)<br>
><br>
> CREATE TABLE public.srtm_tiled<br>
> (<br>
>   rid integer NOT NULL DEFAULT nextval('srtm_tiled_rid_seq'::regclass),<br>
>   rast raster,<br>
>   CONSTRAINT srtm_tiled_pkey PRIMARY KEY (rid)<br>
> )<br>
> WITH (<br>
>   OIDS=FALSE<br>
> );<br>
><br>
> performing the above query returns no rows. So I am not sure what is wrong.. or<br>
> if I am doing this query correctly. Is the SRID set differently in the raster and<br>
> geometry?<br>
<br>
</div>You should do ST_Intersection(o.way , s.rast) instead of ST_Intersection(s.rast, o.way). The first operates in the vector world and the second in the raster world. Let me know if that makes a difference in terms of results.<br>


<br>
Are the SRIDs identical? Did you make sure that the raster were loaded properly by displaying values with ST_Value() or ST_DumpAsPolygons() or simply displaying the raster in QGIS? Does the raster align with the roads properly?<br>


<div><br>
> I also loaded the tif files using the tutorial, but I used the C version not the<br>
> python loader because I understand its been deprecated.<br>
<br>
</div>Should not make any difference.<br>
<br>
Pierre<br>
_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@postgis.refractions.net" target="_blank">postgis-users@postgis.refractions.net</a><br>
<a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>
</blockquote></div><br>
</div></div></blockquote></div><br>