Convert Corrdinate Pixel to Corrdinate Spatial

View: New views
4 Messages — Rating Filter:   Alert me  

Convert Corrdinate Pixel to Corrdinate Spatial

by anhtin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

hi all
I have Point (194, 569) is corrdinate pixel i want convert to corrdinate spatial on postgis
How can i do that ????

Re: Convert Corrdinate Pixel to Corrdinate Spatial

by Stephen Woodbridge :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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 ????

I think you probably need to provide more information. postgis does not
really deal with pixel coordinates. This implies that you have an image
somewhere. Is the image georeferenced? What application is the image in?
like mapserver, ka-map, openLayers, a paint program, etc?

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

Re: Convert Corrdinate Pixel to Corrdinate Spatial

by ValiSystem :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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

Re: Convert Corrdinate Pixel to Corrdinate Spatial

by ValiSystem :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On 11 avr. 07, at 12:14, ValiSystem wrote:

>
> 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 :)
>
>
>
>

Wooops, some typos and mistakes (damn, bad habit to avoid verify what  
i post :) )

The correct query is :

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

(no comma for the WKT point coordinates and and no need of  AsEWKT()  
call )


_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users
LightInTheBox - Buy quality products at wholesale price