MobilityDB 1.3
Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Functions | Variables
tspatial_transform_meos.c File Reference

Functions for transforming coordinates from one SRID to another one. More...

#include "geo/meos_transform.h"
#include <float.h>
#include <string.h>
#include <stdio.h>
#include <postgres.h>
#include <liblwgeom.h>
#include <meos.h>

Data Structures

struct  PjStrs
 Utility structure to get many potential string representations from spatial_ref_sys query. More...
 
struct  spatial_ref_sys_record
 
struct  struct_MEOSPROJSRSCache
 The proj4 cache holds a fixed number of reprojection entries. More...
 
struct  struct_PROJSRSCacheItem
 

Macros

#define MAX_LENGTH_HEADER   1024
 
#define MAX_LENGTH_SRS_RECORD   5120
 
#define maxprojlen   512
 
#define PROJ_BACKEND_HASH_SIZE   256
 PROJ 4 backend hash table initial hash size (since 16 is the default portal hash table size, and we would typically have 2 entries per portal then we shall use a default size of 256) More...
 
#define PROJ_CACHE_ITEMS   128
 
#define SPATIAL_REF_SYS_CSV   "/usr/local/lib/spatial_ref_sys.csv"
 
#define spibufferlen   512
 

Typedefs

typedef struct struct_MEOSPROJSRSCache MEOSPROJSRSCache
 The proj4 cache holds a fixed number of reprojection entries. More...
 
typedef struct struct_PROJSRSCacheItem PROJSRSCacheItem
 

Functions

static LWPROJAddToMEOSPROJSRSCache (MEOSPROJSRSCache *PROJCache, int32_t srid_from, int32_t srid_to)
 Add an entry to the PROJ SRS cache. More...
 
static void DeleteFromMEOSPROJSRSCache (MEOSPROJSRSCache *PROJCache, uint32_t position)
 Remove an entry to the PROJ SRS cache. More...
 
MEOSPROJSRSCacheGetMEOSPROJSRSCache ()
 Get the Proj cache entry from the global variable if one exists. More...
 
static LWPROJGetProjectionFromPROJCache (MEOSPROJSRSCache *cache, int32_t srid_from, int32_t srid_to)
 Get a PROJ structure from the PROJ cache. More...
 
static PjStrs GetProjStrings (int32_t srid)
 Given an SRID, return the corresponding proj strings (auth_name:auth_srid/srtext/proj4text) More...
 
static PjStrs GetProjStringsSPI (int32_t srid)
 Return the PROJ strings of an SRID either from a CSV file spatial_ref_sys.csv (for MEOS) or from the PostGIS table spatial_ref_sys (for MobilityDB) More...
 
int lwproj_lookup (int32_t srid_from, int32_t srid_to, LWPROJ **pj)
 Return 1 if the projection structure was read from the PROJ cache, return 0 otherwise. More...
 
void meos_finalize_projsrs (void)
 Destroy all the malloc'ed PROJ objects stored in the PROJSRSCache. More...
 
static char * pgstrs_get_entry (const PjStrs *strs, int n)
 Return the n-th string of a PROJ strings structure. More...
 
static int pjstrs_has_entry (const PjStrs *strs)
 Return 1 if a PROJ strings structure has all its strings filled, return 0 otherwise. More...
 
static void pjstrs_pfree (PjStrs *strs)
 Delete a PROJ strings structure. More...
 
static void PROJSRSDestroyPJ (void *projection)
 Delete a PROJ structure referenced by a PostGIS projection structure. More...
 
int spheroid_init_from_srid (int32_t srid, SPHEROID *s)
 Return 1 if the spheroid in the last argument was initialized from an SRID, return 0 otherwise. More...
 

Variables

MEOSPROJSRSCacheMEOS_PROJ_CACHE = NULL
 

Detailed Description

Functions for transforming coordinates from one SRID to another one.

PostGIS manages a cache of information obtained from PROJ to speed up transformations (see file file libpgcommon/lw_transform.c). The functions in this file are derived from PostGIS functions by perforning memory allocation with malloc instead of using PostreSQL contexts.