milmil (2) [Avatar] Offline
#1
Hello.
I am using postgis 1.4 and following the instructions in PostGis in Action, I am trying to use real coordinates data (longitude and latitude) that they fetched from a google android mobile device to construct a polygon (I am going to use it as a query box).
Particularly, the loaded coordinates (lon,lat), which are translated as mobile user absolute position will be used as the origin of a circle, having as radius the positional_accuracy of gps device in meters.
So, having the user position in decimal degrees, the radius of a circle in meters, the yaw angle of mobile device embeded compass showing the direction of the user, I want to construct a geometry polygon. Namely, I want to find the four point cartesian coordinates of the polygon. I have some formulas but I cant get true results. I tried transforming WGS84 (EPSG:4326 coordinate reference system of lon lat coordinates) to a planar reference system as Tranverse UTM EPSG:32636 but till now I did not find the solution.
It seems that transformations create a huge polygon. Normally, I must create a polygon that depends from the distance between user position and a real world object that the user is observing. Increasing that distance the query window (polygon) must increase too.
If anyone can help I will really appreciate becuase I am stuck here and I have to deliver very soon my master of thesis LBS & GIS application.
Thank u very much.

Miltos Miltiadous
Postgraduating Information Systmes student in Open University Cyprus.
regina.leo (265) [Avatar] Offline
#2
Re: PROBLEM CONVERTING AND MANIPULATING LONGITUDE AND LATITUDE COORDINATES
Miltos Miltiadous,

Not quite clear what you are looking for, but ST_Buffer might do the trick for you.

Buffer will take a geometry whether be a point or polygon and expand it radially out in the units of the spatial ref. So a point buffered will become a circle

If you are using PostGIS 1.5, you can store your data using the geography format and in native long lat. Then buffering will automatically buffer in meters. PostGIS 1.5 release is eminent and we have windows binaries for RC1 if you want to try it out.

http://www.postgis.org/download/windows/experimental.php

For other OSes its easy to compile your own.

Anyrate check out the following links
http://www.postgis.org/documentation/manual-svn/ST_Buffer.html

http://www.postgis.org/documentation/manual-svn/ch04.html#Geography_Basics
milmil (2) [Avatar] Offline
#3
Re: PROBLEM CONVERTING AND MANIPULATING LONGITUDE AND LATITUDE COORDINATES
Thank u very much for the response. I dont think so that st_buffer will help me on the current issue. Anyway thank u for all your are suggestions. I know that your are specialist in POSTGIS and I imagine and generally in GIS. I found the solution following the suggestion of a member in nabble forum.

PS Your book is fantastic.

Best Regards,
Miltos Miltiadous