[postgis-users] question on returning area size using st_area.

Burgholzer,Robert rwburgholzer at deq.virginia.gov
Tue May 6 06:51:29 PDT 2008


Stephen,

I am shooting in the dark a little here, so, take what I say with a
grain of salt.  Hopefully, someone will see my mangled attempt to
understand this, and chime in with something sensible.  

 

My guess is that, even though the spheroid is WGS84, the units are set
in the SR_text, as follows (for SRID 4326 from my PostGIS db):

 

SRTEXT =  GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 8

4",6378137,298.257223563,AUTHORITY["EPSG","7030"]],TOWGS84[0,0,0,0,0,0,0
],AUTHOR

ITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT[
"degree"

,0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]]


 

Specifically, the parameter:
UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]]

 

Tells me that it wants the units to be in degrees?  So then, what is the
0.0174xx number there? Once again, I can only speculate, but I am
assuming that perhaps this is a conversion to meters or some other
standard unit at some point on the map (perhaps at the prime meridian).


 

So, the real question may be, "can PostGIS be told to measure distance
in a specified unit other than by using a transform?".

 

Robert W. Burgholzer

Surface Water Modeler

Office of Water Supply and Planning

Virginia Department of Environmental Quality

rwburgholzer at deq.virginia.gov

804-698-4405

Open Source Modeling Tools:

http://sourceforge.net/projects/npsource/

-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of
Stephen Lee
Sent: Tuesday, May 06, 2008 3:35 AM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] question on returning area size using
st_area.

 

Thanks Robert,

I have run a query on spatial_ref_sys to check all projection related to
Malaysia and have found quite a few, by trying a few projection listed
there I have some result that is more likely to be true:


SELECT st_area(transform(the_geom, 3385)) / 10000 as hectares

FROM mal_state

WHERE name = 'KELANTAN'


thou i still have no way of verifying them, will try to verify it
somehow. thanks again for your fast and helpful response.

i do have another question, sorry if this is a newbie question, why do
we need to reproject it again if its in WGS84? i thought of putting all
types of free maps into one central database and open it to anyone who
want to use them, if this is the case, lets say someone contribute a map
of Thailand, how do i perform a spatial query if map in different
geographic location has to be manually handled? take for example, if a
query involve both map in Thailand and Malaysia, what kind of
re-projection should i used? And how come the sample data in PostGIS
tutorial do not require a re-projection?

Start reading the PostGIS manual, really appreciate if someone can help
answer these questions or point me the right way. Thanks in advance.

Best regards,

Stephen



On Tue, May 6, 2008 at 3:02 AM, Burgholzer,Robert
<rwburgholzer at deq.virginia.gov> wrote:

Stephen,

This is a classic, and I think it must be in some FAQ some where.  The
only way I have done it is to re-project using the transform function to
something whose units are in meters, since the 4326 SRID has distance
units in meters.  Thus, something like the following:

 

SELECT st_area(transform(the_geom, 26918)) / 10000 as hectares 

FROM mal_state

WHERE name = 'KELANTAN'

 

 

Now, in this example, I have chosen SRID 26918, which off the top of my
head is like NAD 1983, UTM Zone 17.  This is a fairly appropriate
projection for my area (eastern US), however, I don't know enough about
projections to say without reservation that you could use any old
projection without concerning yourself with whether or not the
projection you use is valid in the area that you are operating on in DD.

 

If anyone else has better, more comprehensive insight on this, I for one
would like to hear about it, 

 

 

Robert W. Burgholzer

Surface Water Modeler

Office of Water Supply and Planning

Virginia Department of Environmental Quality

rwburgholzer at deq.virginia.gov

804-698-4405

Open Source Modeling Tools:

http://sourceforge.net/projects/npsource/

 

 

-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of
Stephen Lee
Sent: Monday, May 05, 2008 2:27 PM
To: postgis-users at postgis.refractions.net
Subject: [postgis-users] question on returning area size using st_area.

 

hi there,

i've just started using postgis, i have loaded a sample map of malaysia
using the following command:

F:\PROGRA~1\PostgreSQL\8.3\bin>shp2pgsql -c -s 4326
G:\Maps\Malaysia\Detailsmaps\state_region public.mal_state > state.sql

Shapefile type: Polygon
Postgis type: MULTIPOLYGON[2]

the projection file in the prj is as follow so I assume the SRID is 4326
:

GEOGCS["Lat Long
WGS84",DATUM["D_WGS84",SPHEROID["World_Geodetic_System_of_1984",6378137,
298.257222932867]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943
295]]

the map is successfully loaded and can be viewed using uDig. The problem
occurs when I tried to use the st_area command as state in the PostGIS
(1.3.3) manual (4.6.2.2). the sql statement i issue is:

SELECT
  ST_Area(the_geom)/10000 AS hectares
FROM mal_state
WHERE name = 'KELANTAN';

hectares 
------------------ 
0.000122167591783352 
(1 row)

is the return result measure in the unit of the WGS84 projection? if so
how can i change it to the correct measurement? i have attached my map
file in this email, can someone please shine some light? thanks in
advance.

best regards,

Stephen


_______________________________________________
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/20080506/2462a3fa/attachment.html>


More information about the postgis-users mailing list