Postgis Area size problem

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

Postgis Area size problem

by Paulius J :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I have such a problem. Here is my polygon and it looks that everthing is allright:
POLYGON((56.05364 21.06079,56.43213 22.12646,56.27386 24.55444,56.41998 24.88403,56.17002 25.10376,55.6528 26.63086,54.965 26.25732,54.78168 25.75195,54.31652 25.62012,54.14957 25.74097,54.18173 25.53223,54.28447 25.47729,53.90434 24.37866,53.96255 23.47778,54.25881 23.20313,54.35496 22.77466,54.78802 22.82959,54.95239 22.65381,55.26034 21.32446,56.0475 21.0498,56.05364 21.06079))

But when i want to find the area of it using Area i get the result: 9.04832470074997
I do not know how to get the area size in square meters or something similar to this? Maybe i should use some other function, but according the postgis manual I use Area or ST_Area and have such problem...

P.S. i am using SRID = 4326 for the Geometry column.

Tanks
Paulius J.,
Lithuania

Re: Postgis Area size problem

by Nicolas Ribot :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 11/03/2008, Paulius J <paulius@...> wrote:

>
>  Hello,
>
>  I have such a problem. Here is my polygon and it looks that everthing is
>  allright:
>  POLYGON((56.05364 21.06079,56.43213 22.12646,56.27386 24.55444,56.41998
>  24.88403,56.17002 25.10376,55.6528 26.63086,54.965 26.25732,54.78168
>  25.75195,54.31652 25.62012,54.14957 25.74097,54.18173 25.53223,54.28447
>  25.47729,53.90434 24.37866,53.96255 23.47778,54.25881 23.20313,54.35496
>  22.77466,54.78802 22.82959,54.95239 22.65381,55.26034 21.32446,56.0475
>  21.0498,56.05364 21.06079))
>
>  But when i want to find the area of it using Area i get the result:
>  9.04832470074997
>  I do not know how to get the area size in square meters or something similar
>  to this? Maybe i should use some other function, but according the postgis
>  manual I use Area or ST_Area and have such problem...
>
>  P.S. i am using SRID = 4326 for the Geometry column.
>

ST_area computes the area in geometry's units. Here square degrees.
Repreject your data in a metric reference system (like UTM for
instance) with st_transform(), then compute the area.

Something like:

select st_area(st_transform(geometryFromText('POLYGON((56.05364
21.06079,56.43213 22.12646,56.27386 24.55444,56.41998
24.88403,56.17002 25.10376,55.6528 26.63086,54.965 26.25732,54.78168
25.75195,54.31652 25.62012,54.14957 25.74097,54.18173 25.53223,54.28447
25.47729,53.90434 24.37866,53.96255 23.47778,54.25881 23.20313,54.35496
22.77466,54.78802 22.82959,54.95239 22.65381,55.26034 21.32446,56.0475
21.0498,56.05364 21.06079))', 4326), 32640));

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

Re: Postgis Area size problem

by Paulius J :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thank you for your quick reply Nicolas,

Now I get the results which are more likely to be the truth, but they differ from reality quiet a lot.
Maybe it can be a problem that I got these coordinates from Google Maps? If I am correct, the polygon which I posted as example should be about 64 000 square kilometers.

Paulius J

Nicolas Ribot wrote:
On 11/03/2008, Paulius J <paulius@digitalwork.lt> wrote:
>
>  Hello,
>
>  I have such a problem. Here is my polygon and it looks that everthing is
>  allright:
>  POLYGON((56.05364 21.06079,56.43213 22.12646,56.27386 24.55444,56.41998
>  24.88403,56.17002 25.10376,55.6528 26.63086,54.965 26.25732,54.78168
>  25.75195,54.31652 25.62012,54.14957 25.74097,54.18173 25.53223,54.28447
>  25.47729,53.90434 24.37866,53.96255 23.47778,54.25881 23.20313,54.35496
>  22.77466,54.78802 22.82959,54.95239 22.65381,55.26034 21.32446,56.0475
>  21.0498,56.05364 21.06079))
>
>  But when i want to find the area of it using Area i get the result:
>  9.04832470074997
>  I do not know how to get the area size in square meters or something similar
>  to this? Maybe i should use some other function, but according the postgis
>  manual I use Area or ST_Area and have such problem...
>
>  P.S. i am using SRID = 4326 for the Geometry column.
>

ST_area computes the area in geometry's units. Here square degrees.
Repreject your data in a metric reference system (like UTM for
instance) with st_transform(), then compute the area.

Something like:

select st_area(st_transform(geometryFromText('POLYGON((56.05364
21.06079,56.43213 22.12646,56.27386 24.55444,56.41998
24.88403,56.17002 25.10376,55.6528 26.63086,54.965 26.25732,54.78168
25.75195,54.31652 25.62012,54.14957 25.74097,54.18173 25.53223,54.28447
25.47729,53.90434 24.37866,53.96255 23.47778,54.25881 23.20313,54.35496
22.77466,54.78802 22.82959,54.95239 22.65381,55.26034 21.32446,56.0475
21.0498,56.05364 21.06079))', 4326), 32640));

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

Re: Postgis Area size problem

by Guido Lemoine :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

PJ,

I guess your dealing with Lithuania data. Your problem is twofold:

- You have lat and lon in the wrong order
- You should use UTM zone 35N, which is the one for Lithuania

Hence, do the following:

select st_area(st_transform(geometryFromText('POLYGON((21.06079 56.05364
 ,22.12646 56.43213 ,24.55444 56.27386 ,24.88403 56.41998
 ,25.10376 56.17002 ,26.63086 55.6528 ,26.25732 54.965 ,25.75195 54.78168
 ,25.62012 54.31652 ,25.74097 54.14957 ,25.53223 54.18173 ,25.47729 54.28447
 ,24.37866 53.90434 ,23.47778 53.96255 ,23.20313 54.25881 ,22.77466 54.35496
 ,22.82959 54.78802 ,22.65381 54.95239 ,21.32446 55.26034 ,21.0498 56.0475
 ,21.06079 56.05364 ))', 4326), 32635));

--> 64039242950.5568 (sqm)

GL

Paulius J wrote:

> Thank you for your quick reply Nicolas,
>
> Now I get the results which are more likely to be the truth, but they differ
> from reality quiet a lot.
> Maybe it can be a problem that I got these coordinates from Google Maps? If
> I am correct, the polygon which I posted as example should be about 64 000
> square kilometers.
>
> Paulius J
>
>
> Nicolas Ribot wrote:
>  
>> On 11/03/2008, Paulius J <paulius@...> wrote:
>>    
>>>  Hello,
>>>
>>>  I have such a problem. Here is my polygon and it looks that everthing is
>>>  allright:
>>>  POLYGON((56.05364 21.06079,56.43213 22.12646,56.27386 24.55444,56.41998
>>>  24.88403,56.17002 25.10376,55.6528 26.63086,54.965 26.25732,54.78168
>>>  25.75195,54.31652 25.62012,54.14957 25.74097,54.18173 25.53223,54.28447
>>>  25.47729,53.90434 24.37866,53.96255 23.47778,54.25881 23.20313,54.35496
>>>  22.77466,54.78802 22.82959,54.95239 22.65381,55.26034 21.32446,56.0475
>>>  21.0498,56.05364 21.06079))
>>>
>>>  But when i want to find the area of it using Area i get the result:
>>>  9.04832470074997
>>>  I do not know how to get the area size in square meters or something
>>> similar
>>>  to this? Maybe i should use some other function, but according the
>>> postgis
>>>  manual I use Area or ST_Area and have such problem...
>>>
>>>  P.S. i am using SRID = 4326 for the Geometry column.
>>>
>>>      
>> ST_area computes the area in geometry's units. Here square degrees.
>> Repreject your data in a metric reference system (like UTM for
>> instance) with st_transform(), then compute the area.
>>
>> Something like:
>>
>> select st_area(st_transform(geometryFromText('POLYGON((56.05364
>> 21.06079,56.43213 22.12646,56.27386 24.55444,56.41998
>> 24.88403,56.17002 25.10376,55.6528 26.63086,54.965 26.25732,54.78168
>> 25.75195,54.31652 25.62012,54.14957 25.74097,54.18173 25.53223,54.28447
>> 25.47729,53.90434 24.37866,53.96255 23.47778,54.25881 23.20313,54.35496
>> 22.77466,54.78802 22.82959,54.95239 22.65381,55.26034 21.32446,56.0475
>> 21.0498,56.05364 21.06079))', 4326), 32640));
>>
>> Nico
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users@...
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
>>
>>    
>
>  

--
----------------------------------------------------------------
Guido Lemoine
Joint Research Centre, European Commission
Institute for the Protection and Security of the Citizen (IPSC)
Support to External Security
Via E. Fermi, 2749 TP 267 Ispra 21027 (VA), Italy
Tel. +39 0332 786239 (direct line) Fax. +39 0332 785154
WWW: http://ses.jrc.it
----------------------------------------------------------------
Disclaimer:
Views expressed are those of the individual and do not represent
the views of the European Commission


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

Re: Postgis Area size problem

by Paulius J :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello, GL,

Thanks, for your post. The first part of the problem is easy and at last I got the query working :) While I have some questions about the second:
'- You should use UTM zone 35N, which is the one for Lithuania'. Here as I understand you are talking about SRID`s? If yes, so is it a difference which SRID I am using (I use the database only to save points or group of points from GPS and Google Maps? In database I only want to save the lat and lon from GPS device or Google Maps on the global scope, so which SRID should I use, or there is no difference in my situation? The boundaries of Lithuania is only an example because I live here.


P.S. sorry for such a question but I am new in this.

Paulius J
Guido Lemoine wrote:
PJ,

I guess your dealing with Lithuania data. Your problem is twofold:

- You have lat and lon in the wrong order
- You should use UTM zone 35N, which is the one for Lithuania

Hence, do the following:

select st_area(st_transform(geometryFromText('POLYGON((21.06079 56.05364
 ,22.12646 56.43213 ,24.55444 56.27386 ,24.88403 56.41998
 ,25.10376 56.17002 ,26.63086 55.6528 ,26.25732 54.965 ,25.75195 54.78168
 ,25.62012 54.31652 ,25.74097 54.14957 ,25.53223 54.18173 ,25.47729 54.28447
 ,24.37866 53.90434 ,23.47778 53.96255 ,23.20313 54.25881 ,22.77466 54.35496
 ,22.82959 54.78802 ,22.65381 54.95239 ,21.32446 55.26034 ,21.0498 56.0475
 ,21.06079 56.05364 ))', 4326), 32635));

--> 64039242950.5568 (sqm)

GL

Paulius J wrote:
> Thank you for your quick reply Nicolas,
>
> Now I get the results which are more likely to be the truth, but they differ
> from reality quiet a lot.
> Maybe it can be a problem that I got these coordinates from Google Maps? If
> I am correct, the polygon which I posted as example should be about 64 000
> square kilometers.
>
> Paulius J
>
>
> Nicolas Ribot wrote:
>  
>> On 11/03/2008, Paulius J <paulius@digitalwork.lt> wrote:
>>    
>>>  Hello,
>>>
>>>  I have such a problem. Here is my polygon and it looks that everthing is
>>>  allright:
>>>  POLYGON((56.05364 21.06079,56.43213 22.12646,56.27386 24.55444,56.41998
>>>  24.88403,56.17002 25.10376,55.6528 26.63086,54.965 26.25732,54.78168
>>>  25.75195,54.31652 25.62012,54.14957 25.74097,54.18173 25.53223,54.28447
>>>  25.47729,53.90434 24.37866,53.96255 23.47778,54.25881 23.20313,54.35496
>>>  22.77466,54.78802 22.82959,54.95239 22.65381,55.26034 21.32446,56.0475
>>>  21.0498,56.05364 21.06079))
>>>
>>>  But when i want to find the area of it using Area i get the result:
>>>  9.04832470074997
>>>  I do not know how to get the area size in square meters or something
>>> similar
>>>  to this? Maybe i should use some other function, but according the
>>> postgis
>>>  manual I use Area or ST_Area and have such problem...
>>>
>>>  P.S. i am using SRID = 4326 for the Geometry column.
>>>
>>>      
>> ST_area computes the area in geometry's units. Here square degrees.
>> Repreject your data in a metric reference system (like UTM for
>> instance) with st_transform(), then compute the area.
>>
>> Something like:
>>
>> select st_area(st_transform(geometryFromText('POLYGON((56.05364
>> 21.06079,56.43213 22.12646,56.27386 24.55444,56.41998
>> 24.88403,56.17002 25.10376,55.6528 26.63086,54.965 26.25732,54.78168
>> 25.75195,54.31652 25.62012,54.14957 25.74097,54.18173 25.53223,54.28447
>> 25.47729,53.90434 24.37866,53.96255 23.47778,54.25881 23.20313,54.35496
>> 22.77466,54.78802 22.82959,54.95239 22.65381,55.26034 21.32446,56.0475
>> 21.0498,56.05364 21.06079))', 4326), 32640));
>>
>> Nico
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users@postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
>>
>>    
>
>  

--
----------------------------------------------------------------
Guido Lemoine
Joint Research Centre, European Commission
Institute for the Protection and Security of the Citizen (IPSC)
Support to External Security
Via E. Fermi, 2749 TP 267 Ispra 21027 (VA), Italy
Tel. +39 0332 786239 (direct line) Fax. +39 0332 785154
WWW: http://ses.jrc.it
----------------------------------------------------------------
Disclaimer:
Views expressed are those of the individual and do not represent
the views of the European Commission


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

Re: Postgis Area size problem

by Guido Lemoine :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Paulius,

I referred to Nicolas Ribot's answer to your question on
how to get the area. He suggested to do the transform to
UTM 40N (which has a SRID = 32640, see his statement). This
was likely because he thought your data was somewhere in the
United Arab Emirates, due to the swap in lat, lon.

UTM 35N has SRID = 32635

Hope this solves the puzzle,

Guido

>-- Original Message --
>Date: Wed, 12 Mar 2008 09:52:35 -0700 (PDT)
>From: Paulius J <paulius@...>
>To: postgis-users@...
>Subject: Re: [postgis-users] Postgis Area size problem
>Reply-To: PostGIS Users Discussion <postgis-users@...>
>
>
>
>Hello, GL,
>
>Thanks, for your post. The first part of the problem is easy and at last
>I
>got the query working :) While I have some questions about the second:
>'- You should use UTM zone 35N, which is the one for Lithuania'. Here as
>I
>understand you are talking about SRID`s? If yes, so is it a difference
which

>SRID I am using (I use the database only to save points or group of points
>from GPS and Google Maps? In database I only want to save the lat and lon
>from GPS device or Google Maps on the global scope, so which SRID should
>I
>use, or there is no difference in my situation? The boundaries of Lithuania
>is only an example because I live here.
>
>
>P.S. sorry for such a question but I am new in this.
>
>Paulius J
>
>Guido Lemoine wrote:
>>
>> PJ,
>>
>> I guess your dealing with Lithuania data. Your problem is twofold:
>>
>> - You have lat and lon in the wrong order
>> - You should use UTM zone 35N, which is the one for Lithuania
>>
>> Hence, do the following:
>>
>> select st_area(st_transform(geometryFromText('POLYGON((21.06079 56.05364
>>  ,22.12646 56.43213 ,24.55444 56.27386 ,24.88403 56.41998
>>  ,25.10376 56.17002 ,26.63086 55.6528 ,26.25732 54.965 ,25.75195 54.78168
>>  ,25.62012 54.31652 ,25.74097 54.14957 ,25.53223 54.18173 ,25.47729
>> 54.28447
>>  ,24.37866 53.90434 ,23.47778 53.96255 ,23.20313 54.25881 ,22.77466
>> 54.35496
>>  ,22.82959 54.78802 ,22.65381 54.95239 ,21.32446 55.26034 ,21.0498 56.0475
>>  ,21.06079 56.05364 ))', 4326), 32635));
>>
>> --> 64039242950.5568 (sqm)
>>
>> GL
>>
>> Paulius J wrote:
>>> Thank you for your quick reply Nicolas,
>>>
>>> Now I get the results which are more likely to be the truth, but they
>>> differ
>>> from reality quiet a lot.
>>> Maybe it can be a problem that I got these coordinates from Google Maps?
>>> If
>>> I am correct, the polygon which I posted as example should be about
64

>>> 000
>>> square kilometers.
>>>
>>> Paulius J
>>>
>>>
>>> Nicolas Ribot wrote:
>>>
>>>> On 11/03/2008, Paulius J <paulius@...> wrote:
>>>>
>>>>>  Hello,
>>>>>
>>>>>  I have such a problem. Here is my polygon and it looks that everthing
>>>>> is
>>>>>  allright:
>>>>>  POLYGON((56.05364 21.06079,56.43213 22.12646,56.27386
>>>>> 24.55444,56.41998
>>>>>  24.88403,56.17002 25.10376,55.6528 26.63086,54.965 26.25732,54.78168
>>>>>  25.75195,54.31652 25.62012,54.14957 25.74097,54.18173
>>>>> 25.53223,54.28447
>>>>>  25.47729,53.90434 24.37866,53.96255 23.47778,54.25881
>>>>> 23.20313,54.35496
>>>>>  22.77466,54.78802 22.82959,54.95239 22.65381,55.26034 21.32446,56.0475
>>>>>  21.0498,56.05364 21.06079))
>>>>>
>>>>>  But when i want to find the area of it using Area i get the result:
>>>>>  9.04832470074997
>>>>>  I do not know how to get the area size in square meters or something
>>>>> similar
>>>>>  to this? Maybe i should use some other function, but according the
>>>>> postgis
>>>>>  manual I use Area or ST_Area and have such problem...
>>>>>
>>>>>  P.S. i am using SRID = 4326 for the Geometry column.
>>>>>
>>>>>
>>>> ST_area computes the area in geometry's units. Here square degrees.
>>>> Repreject your data in a metric reference system (like UTM for
>>>> instance) with st_transform(), then compute the area.
>>>>
>>>> Something like:
>>>>
>>>> select st_area(st_transform(geometryFromText('POLYGON((56.05364
>>>> 21.06079,56.43213 22.12646,56.27386 24.55444,56.41998
>>>> 24.88403,56.17002 25.10376,55.6528 26.63086,54.965 26.25732,54.78168
>>>> 25.75195,54.31652 25.62012,54.14957 25.74097,54.18173 25.53223,54.28447
>>>> 25.47729,53.90434 24.37866,53.96255 23.47778,54.25881 23.20313,54.35496
>>>> 22.77466,54.78802 22.82959,54.95239 22.65381,55.26034 21.32446,56.0475
>>>> 21.0498,56.05364 21.06079))', 4326), 32640));
>>>>
>>>> Nico
>>>> _______________________________________________
>>>> postgis-users mailing list
>>>> postgis-users@...
>>>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>>>
>>>>
>>>>
>>>
>>>
>>
>> --
>> ----------------------------------------------------------------
>> Guido Lemoine
>> Joint Research Centre, European Commission
>> Institute for the Protection and Security of the Citizen (IPSC)
>> Support to External Security
>> Via E. Fermi, 2749 TP 267 Ispra 21027 (VA), Italy
>> Tel. +39 0332 786239 (direct line) Fax. +39 0332 785154
>> WWW: http://ses.jrc.it
>> ----------------------------------------------------------------
>> Disclaimer:
>> Views expressed are those of the individual and do not represent
>> the views of the European Commission
>>
>>
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users@...
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
>>
>
>--
>View this message in context: http://www.nabble.com/Postgis-Area-size-problem-tp15988337p16008014.html
>Sent from the PostGIS - User mailing list archive at Nabble.com.
>
>_______________________________________________
>postgis-users mailing list
>postgis-users@...
>http://postgis.refractions.net/mailman/listinfo/postgis-users


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

Re: Postgis Area size problem

by Nicolas Ribot :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> Paulius,
>
>  I referred to Nicolas Ribot's answer to your question on
>  how to get the area. He suggested to do the transform to
>  UTM 40N (which has a SRID = 32640, see his statement). This
>  was likely because he thought your data was somewhere in the
>  United Arab Emirates, due to the swap in lat, lon.
>

Good remark Guido ;-)
I didn't think coordinates could be reverted. I thought Paulius was
working on Arabic countries.
_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users