6.13 Google Maps Considerations
Google Maps uses spherical math in its projections, as opposed to the ellipsoidal math used by Oracle Spatial. This difference can lead to inconsistencies in applications, such as when overlaying a map based on Google Maps with a map based on an Oracle Spatial ellipsoidal projection.
For example, an Oracle Spatial transformation from the ellipsoidal SRID 4326 to the spherical SRID 3785 accounts, by default, for the different ellipsoidal shapes, whereas Google Maps does not consider ellipsoidal shapes.
If you want Oracle Spatial to accommodate the Google Maps results, consider the following options:
-
Use the spherical SRID 4055 instead of the ellipsoidal SRID 4326. This may be the simplest approach; however, if you need to accommodate SRID 4326-based data (such as from a third-party tool) as if it were spherical, you must use another option.
-
Use SRID 3857 instead of SRID 3785. This more convenient than the next two options, because using SRID 3857 does not require that you declare an EPSG rule or that you specify the
USE_SPHERICAL
use case name in order to produce Google-compatible results. -
Declare an EPSG rule between the ellipsoidal and spherical coordinate systems. For example, declare an EPSG rule between SRIDs 4326 and 3785, ignoring the ellipsoidal shape of SRID 4326, as in the following example:
CALL sdo_cs.create_pref_concatenated_op( 302, 'CONCATENATED OPERATION', TFM_PLAN(SDO_TFM_CHAIN(4326, 1000000000, 4055, 19847, 3785)), NULL);
In this example, operation
1000000000
represents no-operation, causing the datum transformation between ellipsoid and sphere to be ignored.With this approach, you must declare a rule for each desired SRID pair (ellipsoidal and spherical).
-
Specify a use case name of
USE_SPHERICAL
with the SDO_CS.TRANSFORM function or the SDO_CS.TRANSFORM_LAYER procedure, as in the following examples:SELECT SDO_CS.TRANSFORM( sdo_geometry(1,1), 'USE_SPHERICAL', 3785) FROM DUAL; CALL SDO_CS.TRANSFORM_LAYER( 'source_geoms', 'GEOMETRY', 'GEO_CS_3785_SPHERICAL', 'USE_SPHERICAL', 3785);
If you specify a
use_case
parameter value ofUSE_SPHERICAL
in such cases, the transformation defaults to using spherical math instead of ellipsoidal math, thereby accommodating Google Maps and some other third-party tools that use spherical math.If you use this approach (specifying
'USE_SPHERICAL'
) but you have also declared an EPSG rule requiring that ellipsoidal math be used in transformations between two specified SRIDs, then the declared EPSG rule takes precedence and ellipsoidal math is used for transformations between those two SRIDs.
Parent topic: Coordinate Systems (Spatial Reference Systems)