[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgis-users
Subject:    Re: [postgis-users] st_value/st_world2rastercoordx error
From:       Bborie Park <bkpark () ucdavis ! edu>
Date:       2012-07-31 14:06:56
Message-ID: CALT_QHC+pSs8jO1zzcz3rSSNrw70wE+0Bk5aPzGDgdYFNwXyUg () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Can you isolate the geometry that is causing the NaN?  Maybe something like

SELECT
  rowid,
  ST_X(geometry)
  ST_Y(geometry)
FROM mygeometrytable

The error message indicates that somehow a NaN is being passed to
ST_World2RasterCoordX...

Also, your query isn't ideal.  You should add another WHERE clause dealing
with the intersection of the rast and the geometry.

UPDATE export.tous_point_espece_selon_format_esri SET
pente_mnt = ST_VALUE(rast, geometrie, true)
FROM raster.pente_mnt30
WHERE code_insee LIKE '30%'
AND ST_Intersects(geometrie, rast)

-bborie

On Tue, Jul 31, 2012 at 2:09 AM, Mathieu Bossaert (CEN L-R)
<sig@cenlr.org>wrote:

> Good morning,
>
> first of all I want to thank the PostGIS community for the great job she
> does.
>
> I am a french user of postgis since 2006 and it helps us a lot in our
> mission to preserve landscapes and biodiversity.
> Since a few month we use rasters function in order to characterize species
> distribution.
>
> I have a problem with 1 of 5 raster table containing a dem.
> When I try to populate an elevation attribute of a point layer from this
> raster I get an error. To workaround this problem I use pg-script to run
> this update line after line.
>
> Is there a way to run this command, skipping the error.
>
> Here is the query :
>
> UPDATE export.tous_point_espece_selon_format_esri SET pente_mnt =
> ST_VALUE(rast, geometrie, true)
> FROM raster.pente_mnt30
> WHERE code_insee LIKE '30%'
>
> And here is the error (sorry it's in french)
>
> ERREUR: syntaxe en entrée invalide pour l'entier : « NaN »
> CONTEXTE : PL/pgSQL function "st_world2rastercoordx" lors de la conversion
> de la valeur de retour au type de retour de la fonction PL/pgSQL function
> "st_value" line 13 at RETURN
>
> Thanks again,
>
> Mathieu Bossaert
>
> --
> *Mathieu BOSSAERT*
> *Responsable du *système d'information <http://si.cenlr.org/> du CEN L-R
> 04 67 29 90 65 - sig@cenlr.org
>
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users@postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>


-- 
Bborie Park
Programmer
Center for Vectorborne Diseases
UC Davis
530-752-8380
bkpark@ucdavis.edu

[Attachment #5 (text/html)]

Can you isolate the geometry that is causing the NaN?  Maybe something \
like<br><br>SELECT<br>  rowid,<br>  ST_X(geometry)<br>  ST_Y(geometry)<br>FROM \
mygeometrytable<br><br>The error message indicates that somehow a NaN is being passed \
to ST_World2RasterCoordX...<br> <br>Also, your query isn&#39;t ideal.  You should add \
another WHERE clause dealing with the intersection of the rast and the \
geometry.<br><br>UPDATE export.tous_point_espece_selon_format_esri SET<br>pente_mnt = \
ST_VALUE(rast, geometrie, true)<br> <div>
FROM raster.pente_mnt30 <br>
WHERE code_insee LIKE &#39;30%&#39;<br>AND ST_Intersects(geometrie, \
rast)<br></div><br>-bborie<br><br><div class="gmail_quote">On Tue, Jul 31, 2012 at \
2:09 AM, Mathieu Bossaert (CEN L-R) <span dir="ltr">&lt;<a \
href="mailto:sig@cenlr.org" target="_blank">sig@cenlr.org</a>&gt;</span> wrote:<br> \
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div><div \
style="font-size:10pt;font-family:arial,helvetica,sans-serif"><div \
style="font-size:10pt;font-family:arial,helvetica,sans-serif"> Good \
morning,<br><br>first of all I want to thank the PostGIS community for the great job \
she does.<br><br>I am a french user of postgis since 2006 and it helps us a lot in \
our mission to preserve landscapes and biodiversity.<br> Since a few month we use \
rasters function in order to characterize species distribution.<br><br>I have a \
problem with 1 of 5 raster table containing a dem.<br>When I try to populate an \
elevation attribute of a point layer from this raster I get an error. To workaround \
this problem I use pg-script to run this update line after line. <br> <br>Is there a \
way to run this command, skipping the error.<br><br>Here is the query : \
<br><br>UPDATE export.tous_point_espece_selon_format_esri SET pente_mnt = \
ST_VALUE(rast, geometrie, true)<br> FROM raster.pente_mnt30 <br>
WHERE code_insee LIKE &#39;30%&#39;<br><br>And here is the error (sorry it&#39;s in \
french)<br><br>ERREUR: syntaxe en entrée invalide pour l&#39;entier : « NaN » \
<br>CONTEXTE : PL/pgSQL function &quot;st_world2rastercoordx&quot; lors de la \
conversion de la valeur de retour au type de retour de la fonction PL/pgSQL function \
&quot;st_value&quot; line 13 at RETURN <br> <br>Thanks again,<br><br>Mathieu \
Bossaert<br><br><div><span></span>--<br><font style="color:rgb(102,102,102)" \
size="1"><i>Mathieu BOSSAERT</i><br style="font-style:italic"><i>Responsable du \
</i><a style="font-style:italic" href="http://si.cenlr.org/" target="_blank">système \
d&#39;information</a></font><font \
style="font-weight:bold;font-style:italic;color:rgb(102,102,102)" size="1"> du CEN \
L-R</font><br> <font style="font-style:italic;color:rgb(102,102,102)" size="1">04 67 \
29 90 65 - <a href="mailto:sig@cenlr.org" \
target="_blank">sig@cenlr.org</a></font><br><img \
src=""><br><span></span><br></div></div></div></div><br>_______________________________________________<br>


postgis-users mailing list<br>
<a href="mailto:postgis-users@postgis.refractions.net">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> \
<br></blockquote></div><br><br clear="all"><br>-- <br>Bborie \
Park<br>Programmer<br>Center for Vectorborne Diseases<br>UC \
Davis<br>530-752-8380<br><a \
href="mailto:bkpark@ucdavis.edu">bkpark@ucdavis.edu</a><br>



_______________________________________________
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic