Top 5 Recent Articles
ARTICLES CATEGORIES
- Algorithms (22)
- All (399)
- Biography (1)
- Blog (44)
- Business Requirements (1)
- Commentary (1)
- Conversion (2)
- Customers (2)
- Data Models (1)
- Education (2)
- GeoRaptor (13)
- GPS (1)
- Image Processing (2)
- Import Export (8)
- Licensing (2)
- LiDAR (1)
- Linear Referencing (4)
- Manifold GIS (3)
- Mapping (1)
- MySQL Spatial (7)
- Networking and Routing (including Optimization) (5)
- Open Source (18)
- Oracle Spatial and Locator (194)
- Partitioning (1)
- PostGIS (36)
- Projections (1)
- Published Articles (1)
- qGIS (1)
- Recommendations (1)
- Services (1)
- Software Change Log (1)
- Source Code (37)
- Space Curves (9)
- Spatial Database Functions (109)
- Spatial DB comparison (1)
- Spatial XML Processing (11)
- SQL Server Spatial (92)
- Standards (3)
- Stored Procedure (17)
- Tessellation or Gridding (10)
- Tools (2)
- Topological Relationships (1)
- Training (2)
- Triangulation (2)
Australian MGA/AMG Zone Calculation from geographic (longitude/latitude) data
Someone asked on Oracle Technet recently about how to compute the Australian AMG/MGA (UTM) zone from longitude latitude data (geographicals) expressed in NAD84.
My solution is via a single SQL statement as follows (the first statement is just to show the SRIDs associated with the right projections.
DEFINE BASE_AGD66=81857 DEFINE BASE_AGD84=81858 DEFINE AGD6684=2 SET PAGESIZE 1000 LINESIZE 150 COLUMN CS_NAME FORMAT A25 WRAPPED select srid,cs_name from mdsys.cs_srs where UPPER(cs_name) like '%AMG ZONE%' or UPPER(cs_name) like '%MGA94 ZONE%' order by srid / COLUMN AMG66Name FORMAT A20 WRAPPED COLUMN AMG84Name FORMAT A20 WRAPPED COLUMN MGA94Name FORMAT A20 WRAPPED SELECT longitude, latitude, UTMZone, AMG66SRID, (SELECT cs_name FROM mdsys.cs_srs WHERE SRID = AMG66SRID) AS AMG66Name, mdsys.sdo_cs.transform(mdsys.sdo_geometry(2001,8265,MDSYS.SDO_POINT_TYPE(longitude,latitude, NULL),NULL,NULL),AMG66SRID) AS AMG66Geom, AMG84SRID, (SELECT cs_name FROM mdsys.cs_srs WHERE SRID = AMG84SRID) AS AMG84Name, mdsys.sdo_cs.transform(mdsys.sdo_geometry(2001,8265,MDSYS.SDO_POINT_TYPE(longitude,latitude,NULL),NULL,NULL),AMG84SRID) AS AMG84Geom, MGA94SRID, (SELECT cs_name FROM mdsys.cs_srs WHERE SRID = MGA94SRID) AS MGA94Name, mdsys.sdo_cs.transform(mdsys.sdo_geometry(2001,8265,MDSYS.SDO_POINT_TYPE(longitude,latitude,NULL),NULL,NULL),MGA94SRID) AS MGA94Geom FROM (SELECT LEVEL + 95 as longitude, dbms_random.value(-10,-45) as latitude, 31 + trunc((LEVEL + 95) / 6) as UTMZone, &&BASE_AGD66. + 31 + ( trunc((LEVEL + 95) / 6) * &&AGD6684. ) as AMG66SRID, &&BASE_AGD84. + 31 + ( trunc((LEVEL + 95) / 6) * &&AGD6684. ) as AMG84SRID, 82413 + 31 + trunc((LEVEL + 95) / 6) as MGA94SRID FROM dual CONNECT BY LEVEL < ( 168 - 96 + 1 ) /* Max Long is 168 and Min is 96 */ ) /
Documentation
- MySQL Spatial General Functions
- Oracle LRS Objects
- Oracle Spatial Exporter (Java + pl/SQL)
- Oracle Spatial Object Functions
- Oracle Spatial Object Functions (Multi Page)
- PostGIS pl/pgSQL Functions
- SC4O Oracle Java Topology Suite (Java + pl/SQL)
- SQL Server Spatial General TSQL Functions
- SQL Server Spatial LRS TSQL Functions