on 2016 Aug 22 11:20 AM
Hi !
In oracle i have polygon ,he area 8,6 ha.
its coordinates
(37.67864227294922 50.4218626237537,37.67864227294922 50.42404998528019,37.68362045288086 50.42404998528019,37.68362045288086 50.4218626237537, 37.67864227294922 50.4218626237537)
in HANA i create this polygon like this
insert into MY_TABLE(id,spolygon)
select 7777777,NEW ST_Polygon('Polygon ((37.67864227294922 50.4218626237537,37.67864227294922 50.42404998528019,37.68362045288086 50.42404998528019,37.68362045288086 50.4218626237537,37.67864227294922 50.4218626237537))') from dummy;
When i calculating area
select p.spolygon.st_area() from MY_TABLE p where p.id=7777777;
I get 0,000010890908015426248. -- what kind of unit, where it comes from (how to configure it), how do i calculate the area in hectares?
if i do like this p.spolygon.st_area() * 1000000 i get 10.8 not 8,6 ha
What shall I do to get my 8.6 hectare ?
Hello Viktor,
cause you did not define a Spatial Reference Identifier (SRID), the default SRID 0 is used which is a flat, 2D plane system. So ST_AREA just returns the result value as double value with an "undefined type" I would say for your input polygon with long/lat values. Of course as it can be seen in the system view ST_SPATIAL_REFERENCE_SYSTEMS the default linear unit is "meter", but that is not true in your case, cause you do not pass meter values.
The best fitting SRID would be 4326 (WGS84) (a list of the supported SRID and a description for it can be found here: Spatial Reference Systems (SRS) and Spatial Reference Identifiers (SRID) - SAP HANA Spatial Referenc...), but that SRID does not support the ST_Area method (4326 is a round-earth type) as described here: List of All Supported Methods - SAP HANA Spatial Reference.
So the only long/lat SRID supporting ST_Area is 100004326 (WGS84 planar), but it is not a round-earth type and therefore has differences in area/distance calculations. As it can be read in the link added above, it is therefore also not recommended to use it for such calculations. But just for demo purposes following example calculates the square meters for your coordinates. As it can be seen, SRID 100000436 is defined and as unit for ST_Area "meter" is defined (cause the default for the choosen SRID is planar degree):
select NEW ST_Polygon('Polygon ((
37.67864227294922 50.4218626237537,
37.67864227294922 50.42404998528019,
37.68362045288086 50.42404998528019,
37.68362045288086 50.4218626237537,
37.67864227294922 50.4218626237537))',1000004326).ST_Area('meter') from dummy;
The result does also not match your expected result (converted to hectar), but it should give you some hints and insights that different SRIDs exist and why your calculation with default SRID 0 returns the result as it is.
Regards,
Florian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
69 | |
13 | |
10 | |
10 | |
9 | |
9 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.