Skip to content

Commit

Permalink
Remove support for PROJ < 6
Browse files Browse the repository at this point in the history
Require PROJ >= 6.1 (6.0 was not supported)
6.1 was released in May 2019, 4 years ago. None of our CI tests PROJ < 6
anymore.
  • Loading branch information
rouault committed Jun 3, 2023
1 parent 5508c3c commit 3e48d71
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 596 deletions.
12 changes: 5 additions & 7 deletions cmake/FindProj.cmake
Expand Up @@ -6,7 +6,7 @@
# PROJ_LIBRARY


FIND_PATH(PROJ_INCLUDE_DIR NAMES proj.h proj_api.h)
FIND_PATH(PROJ_INCLUDE_DIR NAMES proj.h)

FIND_LIBRARY(PROJ_LIBRARY NAMES proj proj_i)

Expand All @@ -20,21 +20,19 @@ IF (PROJ_INCLUDE_DIR AND PROJ_LIBRARY)
ENDIF (PROJ_INCLUDE_DIR AND PROJ_LIBRARY)

IF (PROJ_FOUND)
IF (EXISTS ${PROJ_INCLUDE_DIR}/proj.h)
FILE(READ ${PROJ_INCLUDE_DIR}/proj.h proj_version)
STRING(REGEX REPLACE "^.*PROJ_VERSION_MAJOR +([0-9]+).*$" "\\1" PROJ_VERSION_MAJOR "${proj_version}")
STRING(REGEX REPLACE "^.*PROJ_VERSION_MINOR +([0-9]+).*$" "\\1" PROJ_VERSION_MINOR "${proj_version}")
STRING(REGEX REPLACE "^.*PROJ_VERSION_PATCH +([0-9]+).*$" "\\1" PROJ_VERSION_PATCH "${proj_version}")

MESSAGE(STATUS "Found Proj ${PROJ_VERSION_MAJOR}.${PROJ_VERSION_MINOR}")

IF (PROJ_VERSION_MAJOR EQUAL 6 AND PROJ_VERSION_MINOR EQUAL 0)
MESSAGE (FATAL_ERROR "PROJ 6.0 is not supported. Use 6.1.0 or higher.")
ENDIF()
IF ((PROJ_VERSION_MAJOR EQUAL 6) AND (PROJ_VERSION_MINOR EQUAL 3) AND (PROJ_VERSION_PATCH EQUAL 0))
MESSAGE (FATAL_ERROR "MapServer known to crash with PROJ 6.3.0. Use 6.3.1 or higher.")
ENDIF ((PROJ_VERSION_MAJOR EQUAL 6) AND (PROJ_VERSION_MINOR EQUAL 3) AND (PROJ_VERSION_PATCH EQUAL 0))
ENDIF()

ADD_DEFINITIONS(-DPROJ_VERSION_MAJOR=${PROJ_VERSION_MAJOR})
ELSE()
MESSAGE(STATUS "Found Proj 4.x")
ADD_DEFINITIONS(-DPROJ_VERSION_MAJOR=4)
ENDIF()
ENDIF (PROJ_FOUND)
5 changes: 1 addition & 4 deletions mapogr.cpp
Expand Up @@ -1000,9 +1000,7 @@ static int msOGRSpatialRef2ProjectionObj(OGRSpatialReferenceH hSRS,
return MS_SUCCESS;
}

#if PROJ_VERSION_MAJOR >= 6
// This could be done also in the < 6 case, but would be useless.
// Here this helps avoiding going through potentially lossy PROJ4 strings
// This helps avoiding going through potentially lossy PROJ4 strings
const char* pszAuthName = OSRGetAuthorityName(hSRS, NULL);
if( pszAuthName && EQUAL(pszAuthName, "EPSG") )
{
Expand All @@ -1018,7 +1016,6 @@ static int msOGRSpatialRef2ProjectionObj(OGRSpatialReferenceH hSRS,
return msLoadProjectionString(proj, szInitStr) == 0 ? MS_SUCCESS : MS_FAILURE;
}
}
#endif

// Export OGR SRS to a PROJ4 string
char *pszProj = NULL;
Expand Down

0 comments on commit 3e48d71

Please sign in to comment.