MCPcopy Create free account
hub / github.com/MapServer/MapServer / msOracleSpatialLayerGetAutoProjection

Function msOracleSpatialLayerGetAutoProjection

maporaclespatial.c:2818–2916  ·  view source on GitHub ↗

AutoProjection Support for RFC 37 #3333 * TODO: Needs testing */

Source from the content-addressed store, hash-verified

2816 * TODO: Needs testing
2817 */
2818int msOracleSpatialLayerGetAutoProjection( layerObj *layer, projectionObj *projection )
2819{
2820 char *table_name;
2821 char *query_str, *geom_column_name = NULL, *unique = NULL, *srid = NULL;
2822 int success;
2823 int function = 0;
2824 int version = 0;
2825 char wktext[4000];
2826
2827 OCIDefine *def1p = NULL;
2828 OCIBind *bnd1p = NULL, *bnd2p = NULL;
2829
2830 msOracleSpatialLayerInfo *layerinfo = (msOracleSpatialLayerInfo *)layer->layerinfo;
2831 msOracleSpatialDataHandler *dthand = NULL;
2832 msOracleSpatialHandler *hand = NULL;
2833 msOracleSpatialStatement *sthand = NULL;
2834
2835 if (layer->debug)
2836 msDebug("msOracleSpatialLayerGetAutoProjection was called.\n");
2837
2838 if (layerinfo == NULL)
2839 {
2840 msSetError( MS_ORACLESPATIALERR, "msOracleSpatialLayerGetAutoProjection called on unopened layer","msOracleSpatialLayerGetAutoProjection()");
2841 return MS_FAILURE;
2842 }
2843 else
2844 {
2845 dthand = (msOracleSpatialDataHandler *)layerinfo->oradatahandlers;
2846 hand = (msOracleSpatialHandler *)layerinfo->orahandlers;
2847 sthand = (msOracleSpatialStatement *) layerinfo->orastmt;
2848 }
2849
2850 table_name = (char *) malloc(sizeof(char) * TABLE_NAME_SIZE);
2851 if (!msSplitData( layer->data, &geom_column_name, &table_name, &unique, &srid, &function, &version ))
2852 {
2853 msSetError( MS_ORACLESPATIALERR,
2854 "Error parsing OracleSpatial DATA variable. Must be: "
2855 "'geometry_column FROM table_name [USING UNIQUE <column> SRID srid# FUNCTION]' or "
2856 "'geometry_column FROM (SELECT stmt) [USING UNIQUE <column> SRID srid# FUNCTION]'. "
2857 "If want to set the FUNCTION statement you can use: FILTER, RELATE, GEOMRELATE or NONE. "
2858 "Your data statement: %s",
2859 "msOracleSpatialLayerGetAutoProjection()", layer->data );
2860
2861 if (geom_column_name) free(geom_column_name);
2862 if (srid) free(srid);
2863 if (unique) free(unique);
2864 free(table_name);
2865
2866 return MS_FAILURE;
2867 }
2868
2869 query_str = "SELECT wktext FROM mdsys.all_sdo_geom_metadata m, mdsys.cs_srs c WHERE c.srid = m.srid and m.owner||'.'||m.table_name = :table_name and m.column_name = :geo_col_name "
2870 "UNION SELECT wktext from mdsys.user_sdo_geom_metadata m, mdsys.cs_srs c WHERE c.srid = m.srid and m.table_name = :table_name and m.column_name = :geo_col_name";
2871
2872 if (layer->debug)
2873 msDebug("msOracleSpatialLayerGetAutoProjection. Using this Sql to retrieve the projection: %s.\n", query_str);
2874
2875 /*Prepare the handlers to the query*/

Callers

nothing calls this directly

Calls 5

msDebugFunction · 0.85
msSetErrorFunction · 0.85
msSplitDataFunction · 0.85
TRYFunction · 0.85
msOGCWKT2ProjectionObjFunction · 0.85

Tested by

no test coverage detected