« Return to Thread: Convert Corrdinate Pixel to Corrdinate Spatial

Re: Convert Corrdinate Pixel to Corrdinate Spatial

by ValiSystem :: Rate this Message:

Reply to Author | View in Thread


On 11 avr. 07, at 05:54, anhtin wrote:

>
> hi all
> I have Point (194, 569) is corrdinate pixel i want convert to  
> corrdinate
> spatial on postgis
> How can i do that ????
> --
> View this message in context: http://www.nabble.com/Convert- 
> Corrdinate-Pixel-to-Corrdinate-Spatial-tf3557178.html#a9932812
> Sent from the PostGIS - User mailing list archive at Nabble.com.
>


Hi,

This is more a gdal thing, but there is no simple tool to do that.  
But what you can do if you want to keep most of the work in postgis,  
is to manually convert your pixel coordinates in your image spatial  
coordinates system, and then convert it to your final coordinates  
system (Lat Lon for example) inside postgis using Transform().

Assuming that your image projection use a orthogonal coordinates  
system (it should), converting your pixel coordinates  xp, yp in your  
image spatial coordinates system is easy, for an image that have  
x1,y1 for bottom left corner and x2,y2 for top left corner (get it  
with gdalinfo) you just have to do :

x = xp/width * (x2 - x1) + x1
y = yp/height * (y2 - y1) + y1

then you can do

SELECT Transform(AsEWKT("SRID=<IMAGE_SRID>;POINT(<x>, <y>)"),  
<TARGET_SRID>);

to let postgis calculate the complicated thing.

But your message wasn't very clear, your may just need the first part  
of my response :)



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

 « Return to Thread: Convert Corrdinate Pixel to Corrdinate Spatial