[postgis-users] Raster + Geometry Intersection

Ed Linde edolinde at gmail.com
Tue Feb 28 01:12:37 PST 2012


I did a "yum install proj-nad" on my Fedora c 15 box, and the projection
error is gone. Now I have a new one! :(


SELECT o.osm_id,
         ST_Intersection(ST_Transform(o.way,4326), s.rast)
  FROM planet_osm_line o,
       srtm_tiled_4326 s
  WHERE ST_Intersects(ST_Transform(o.way,4326), s.rast)
  and   o.highway = 'primary';

I keep seeing the following messages below!

NOTICE:  Ring Self-intersection at or near point 8.50333 55.5392
CONTEXT:  PL/pgSQL function "st_intersection" line 10 at RETURN QUERY
NOTICE:  Ring Self-intersection at or near point 8.87833 55.5408
CONTEXT:  PL/pgSQL function "st_intersection" line 10 at RETURN QUERY
NOTICE:  Ring Self-intersection at or near point 8.63 55.5192
CONTEXT:  PL/pgSQL function "st_intersection" line 10 at RETURN QUERY
NOTICE:  Ring Self-intersection at or near point 8.685 55.5083

Can someone please explain what these messages mean? Am I doing something
wrong?

Cheers,
Ed




On Tue, Feb 28, 2012 at 9:21 AM, Ed Linde <edolinde at gmail.com> wrote:

> I have loaded my SRTM tif files as srid = 4326. And use a ST_Transform on
> the road geometry (As suggested).
> Running Query:
>
> SELECT o.osm_id,
>          ST_Intersection(ST_Transform(o.way,4326), s.rast)
>   FROM planet_osm_line o,
>        srtm_tiled_4326 s
>   WHERE ST_Intersects(ST_Transform(o.way,4326), s.rast);
>
> I get this error:
>
> *NOTICE:  PostGIS was unable to transform the point because either no
> grid shift files were found, or the point does
> not lie within the range for which the grid shift is defined. Refer to the
> ST_Transform() section of the PostGIS manual
> for details on how to configure PostGIS to alter this behaviour.
>
> ERROR:  transform: couldn't project point (977705 5.98119e+06 0): failed
> to load NAD27-83 correction file (-38)
> ********** Error **********
> ERROR: transform: couldn't project point (977705 5.98119e+06 0): failed to
> load NAD27-83 correction file (-38)
> SQL state: XX000
>
> *I looked up the postgis manual on ST_Transform and it suggests doing
> --->
>
> UPDATE spatial_ref_sys SET proj4text = '+proj=longlat +ellps=clrk66 +nadgrids=@conus, at alaska, at ntv2_0.gsb, at ntv1_can.dat,null +no_defs' WHERE srid = 4326;
>
> Is this the correct way to add a grid? Or is there some better way? Some
> other threads on this mailing list suggest copying some files over
> and placing them in another folder.. not sure what is the better way. Can
> someone please suggest?
>
> I am on -->
>
> -------------------------------------------------------------------------------------------------------------------------------------------------------
> * POSTGIS="2.0.0alpha7SVN" GEOS="3.3.0-CAPI-1.7.0" PROJ="Rel. 4.7.1, 23
> September 2009" GDAL="GDAL 1.7.3, released 2010/11/10" LIBXML="2.7.8"
> USE_STATS
> *(1 row)
>
> Cheers,
> Ed
>
>
>
>
>
> On Mon, Feb 27, 2012 at 4:05 PM, Pierre Racine <
> Pierre.Racine at sbf.ulaval.ca> wrote:
>
>> > ok, just to get this right.. :) , you are suggesting I keep my OSM as
>> is (id: 900913).
>> > Load in the tif rasters as srid (4326) and then "reproject" the OSM
>> road geometry
>> > to srid = 4326 right? So it matches the srid of my raster! I ask
>> because you said
>> > to reproject to 900913 in your mail.
>>
>> Correct. We're on the right way.
>>
>> You can  create a new raster table (after loading them properly with
>> 4326) with your rasters reprojected to 900913 but as I said you might hit
>> our bug:
>>
>> http://trac.osgeo.org/postgis/ticket/1618
>>
>> Pierre
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20120228/41dc8651/attachment.html>


More information about the postgis-users mailing list