Вопрос

I am looking for a way to convert from WGS84 to UTM Zone 21

I've only found a SDO_CS.TO_USNG function in oracle spatial, but this converts to United States National Grid (USNG), this is the example

Select SDO_CS.to_USNG( 
             SDO_GEOMETRY( 2001,8307,
                           SDO_POINT_TYPE(-57.5451,-25.2371,NULL),
                           NULL,NULL), 
                     1
                     ) UTM_MGRS 
 from dual;

_______________
21JVN4510008687

The conversion to UTM would be x=445099,61395302, y= 7208686,7337054

Это было полезно?

Решение

You could use transform() function of sdo_cs package to do conversion:

select t.sdo.sdo_point.x as x
     , t.sdo.sdo_point.y as y
  from (select sdo_cs.transform( 
                       sdo_geometry( 2001
                                   , 8307  --Longitude / Latitude (WGS 84)  SRID
                                   , SDO_POINT_TYPE(-57.5451,-25.2371,NULL)
                                   , null
                                   , null)
                             , 82288       -- UTM Zone 21 SRID
                            ) as sdo
        from dual
      ) t

Result:

 X            Y
----------   ----------
445099.614   7208686.74 

Другие советы

Just to add to the above. One way to find the SRID that you need (e.g. the 82288 used above) is to query the cs_srs table.

select cs_name, srid from cs_srs where cs_name like '%UTM Zone 21%';

S_NAME SRID


UTM Zone 21 (NAD 27 for Canada) 82281 UTM Zone 21 (NAD 83) 82282 UTM Zone 21, Northern Hemisphere (Corrego Alegre) 82283 UTM Zone 21, Northern Hemisphere (SAD 69) 82284 UTM Zone 21, Northern Hemisphere (WGS 84) 82285 UTM Zone 21, Southern Hemisphere (Corrego Alegre) 82286 UTM Zone 21, Southern Hemisphere (SAD 69) 82287 UTM Zone 21, Southern Hemisphere (WGS 84) 82288

8 rows selected.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top