forked from postgis/postgis
Add new entries to spatial_ref_sys and handle non-EPSG authnames
Closes #4417 git-svn-id: http://svn.osgeo.org/postgis/trunk@17592 b70326c6-7e19-0410-871a-916f4a2858eestable-3.0
parent
6c7eba8c1c
commit
4d4891e120
1
NEWS
1
NEWS
|
@ -10,6 +10,7 @@ Additional features enabled if you are running Proj6+ and PostgreSQL 12
|
|||
- #4451, Fix the calculation of gserialized_max_header_size (Raúl Marín)
|
||||
- #4450, Speed up ST_GeometryType (Raúl Marín)
|
||||
- #4452, Add ST_TileEnvelope() (Paul Ramsey)
|
||||
- #4417, Update spatial_ref_sys with new entries (Paul Ramsey)
|
||||
|
||||
|
||||
PostGIS 3.0.0alpha3
|
||||
|
|
|
@ -54,7 +54,7 @@ static char *spatialRefSysSchema = NULL;
|
|||
* from spatial_ref_sys query.
|
||||
*/
|
||||
typedef struct {
|
||||
char* epsgtext;
|
||||
char* authtext;
|
||||
char* srtext;
|
||||
char* proj4text;
|
||||
} PjStrs;
|
||||
|
@ -402,18 +402,17 @@ GetProjStringsSPI(int32_t srid)
|
|||
if (proj4text && strlen(proj4text))
|
||||
strs.proj4text = SPI_pstrdup(proj4text);
|
||||
|
||||
/* For Proj >= 6 prefer "EPSG:XXXX" to proj strings */
|
||||
/* For Proj >= 6 prefer "AUTHNAME:AUTHSRID" to proj strings */
|
||||
/* as proj_create_crs_to_crs() will give us more consistent */
|
||||
/* results with EPSG numbers than with proj strings */
|
||||
/* results with authority numbers than with proj strings */
|
||||
char* authname = SPI_getvalue(tuple, tupdesc, 2);
|
||||
char* authsrid = SPI_getvalue(tuple, tupdesc, 3);
|
||||
if (authname && authsrid &&
|
||||
strcmp(authname,"EPSG") == 0 &&
|
||||
strlen(authsrid))
|
||||
strlen(authname) && strlen(authsrid))
|
||||
{
|
||||
char tmp[maxprojlen];
|
||||
snprintf(tmp, maxprojlen, "EPSG:%s", authsrid);
|
||||
strs.epsgtext = SPI_pstrdup(tmp);
|
||||
snprintf(tmp, maxprojlen, "%s:%s", authname, authsrid);
|
||||
strs.authtext = SPI_pstrdup(tmp);
|
||||
}
|
||||
|
||||
/* Proj6+ can parse srtext, so return that too */
|
||||
|
@ -534,7 +533,7 @@ static int
|
|||
pjstrs_has_entry(const PjStrs *strs)
|
||||
{
|
||||
if ((strs->proj4text && strlen(strs->proj4text)) ||
|
||||
(strs->epsgtext && strlen(strs->epsgtext)) ||
|
||||
(strs->authtext && strlen(strs->authtext)) ||
|
||||
(strs->srtext && strlen(strs->srtext)))
|
||||
return 1;
|
||||
else
|
||||
|
@ -546,8 +545,8 @@ pjstrs_pfree(PjStrs *strs)
|
|||
{
|
||||
if (strs->proj4text)
|
||||
pfree(strs->proj4text);
|
||||
if (strs->epsgtext)
|
||||
pfree(strs->epsgtext);
|
||||
if (strs->authtext)
|
||||
pfree(strs->authtext);
|
||||
if (strs->srtext)
|
||||
pfree(strs->srtext);
|
||||
}
|
||||
|
@ -559,7 +558,7 @@ pgstrs_get_entry(const PjStrs *strs, int n)
|
|||
switch (n)
|
||||
{
|
||||
case 0:
|
||||
return strs->epsgtext;
|
||||
return strs->authtext;
|
||||
case 1:
|
||||
return strs->srtext;
|
||||
case 2:
|
||||
|
|
|
@ -334,24 +334,24 @@ gml_reproject_pa(POINTARRAY *pa, int32_t srid_in, int32_t srid_out)
|
|||
* lookups directly. Drop this ugly hack.
|
||||
*/
|
||||
static POINTARRAY *
|
||||
gml_reproject_pa(POINTARRAY *pa, int32_t srid_in, int32_t srid_out)
|
||||
gml_reproject_pa(POINTARRAY *pa, int32_t epsg_in, int32_t epsg_out)
|
||||
{
|
||||
PJ *pj;
|
||||
LWPROJ *lwp;
|
||||
char text_in[32];
|
||||
char text_out[32];
|
||||
char text_in[16];
|
||||
char text_out[16];
|
||||
|
||||
if (srid_in == SRID_UNKNOWN)
|
||||
if (epsg_in == SRID_UNKNOWN)
|
||||
return pa; /* nothing to do */
|
||||
|
||||
if (srid_out == SRID_UNKNOWN)
|
||||
if (epsg_out == SRID_UNKNOWN)
|
||||
{
|
||||
gml_lwpgerror("invalid GML representation", 3);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
snprintf(text_in, 32, "EPSG:%d", srid_in);
|
||||
snprintf(text_out, 32, "EPSG:%d", srid_out);
|
||||
snprintf(text_in, 16, "EPSG:%d", epsg_in);
|
||||
snprintf(text_out, 16, "EPSG:%d", epsg_out);
|
||||
pj = proj_create_crs_to_crs(NULL, text_in, text_out, NULL);
|
||||
|
||||
lwp = lwproj_from_PJ(pj, LW_FALSE);
|
||||
|
|
10976
spatial_ref_sys.sql
10976
spatial_ref_sys.sql
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue