pg_eviltransform
pg_eviltransform : Coordinate transforms for BD09/GCJ02 via PostGIS ST_Transform
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 1580 | pg_eviltransform | pg_eviltransform | 0.0.8 |
GIS | MIT | Rust |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
| --s-d-r | No | Yes | No | Yes | yes | no |
| Relationships | |
|---|---|
| Schemas | eviltransform_internal |
| Requires | postgis |
| See Also | postgis h3 pg_geohash pg_polyline earthdistance qdgc convert pgrouting nominatim_fdw q3c |
Packages
| Linux / PG | PG19 | PG18 | PG17 | PG16 | PG15 |
|---|---|---|---|---|---|
| el8.x86_64 | N/A | PIGSTY 0.0.7 | PIGSTY 0.0.7 | PIGSTY 0.0.7 | PIGSTY 0.0.7 |
| el8.aarch64 | N/A | PIGSTY 0.0.7 | PIGSTY 0.0.7 | PIGSTY 0.0.7 | PIGSTY 0.0.7 |
| el9.x86_64 | MISS | PIGSTY 0.0.7 | PIGSTY 0.0.7 | PIGSTY 0.0.7 | PIGSTY 0.0.7 |
| el9.aarch64 | MISS | PIGSTY 0.0.7 | PIGSTY 0.0.7 | PIGSTY 0.0.7 | PIGSTY 0.0.7 |
| el10.x86_64 | MISS | PIGSTY 0.0.7 | PIGSTY 0.0.7 | PIGSTY 0.0.7 | PIGSTY 0.0.7 |
| el10.aarch64 | MISS | PIGSTY 0.0.7 | PIGSTY 0.0.7 | PIGSTY 0.0.7 | PIGSTY 0.0.7 |
| d12.x86_64 | MISS | PIGSTY 0.0.7 | PIGSTY 0.0.7 | PIGSTY 0.0.7 | PIGSTY 0.0.7 |
| d12.aarch64 | MISS | PIGSTY 0.0.7 | PIGSTY 0.0.7 | PIGSTY 0.0.7 | PIGSTY 0.0.7 |
| d13.x86_64 | MISS | PIGSTY 0.0.7 | PIGSTY 0.0.7 | PIGSTY 0.0.7 | PIGSTY 0.0.7 |
| d13.aarch64 | MISS | PIGSTY 0.0.7 | PIGSTY 0.0.7 | PIGSTY 0.0.7 | PIGSTY 0.0.7 |
| u22.x86_64 | MISS | PIGSTY 0.0.7 | PIGSTY 0.0.7 | PIGSTY 0.0.7 | PIGSTY 0.0.7 |
| u22.aarch64 | MISS | PIGSTY 0.0.7 | PIGSTY 0.0.7 | PIGSTY 0.0.7 | PIGSTY 0.0.7 |
| u24.x86_64 | MISS | PIGSTY 0.0.7 | PIGSTY 0.0.7 | PIGSTY 0.0.7 | PIGSTY 0.0.7 |
| u24.aarch64 | MISS | PIGSTY 0.0.7 | PIGSTY 0.0.7 | PIGSTY 0.0.7 | PIGSTY 0.0.7 |
| u26.x86_64 | MISS | PIGSTY 0.0.7 | PIGSTY 0.0.7 | PIGSTY 0.0.7 | PIGSTY 0.0.7 |
| u26.aarch64 | MISS | PIGSTY 0.0.7 | PIGSTY 0.0.7 | PIGSTY 0.0.7 | PIGSTY 0.0.7 |
Source
github.com/aiyou178/pg_eviltransform
pg_eviltransform-0.0.8.tar.gz
Install
Make sure PGDG and PIGSTY repo available:
Install this extension with pig:
Create this extension with:
Usage
Sources:
pg_eviltransform extends PostGIS with coordinate transformations involving China’s GCJ-02 and BD-09 systems. Version 0.0.4 also adds exact Jenks natural-break classification through ST_JenksBins array and aggregate overloads.
Coordinate Transformation
Custom SRIDs are 990001 for GCJ-02 and 990002 for BD-09. When neither endpoint uses a custom system, ST_EvilTransform delegates to PostGIS ST_Transform; otherwise it converts through WGS84 (4326) when necessary.
Version 0.0.7 adds the geographic CGCS2000 aliases CGCS2000, CGCS-2000, 4490, and EPSG:4490 to text overloads. PostGIS/PROJ chooses the datum transformation. For a projected CGCS2000 Gauss-Kruger zone, use its explicit integer EPSG SRID.
Jenks Natural Breaks
Array inputs support numeric, double precision, real, bigint, integer, and smallint. Aggregate inputs are numeric or double precision; cast other numeric columns when needed.
API Index and Caveats
ST_EvilTransform(geometry, integer|text)andST_EvilTransform(geometry, text, integer|text): four overloads corresponding to the PostGISST_Transforminterface.ST_JenksBins(values[], breaks [, invert]): classifies an array and returnsdouble precision[]edges.ST_JenksBins(value, breaks [, invert]): streaming aggregate that avoids materializingarray_agg.- PostGIS is a runtime prerequisite and must be installed before
pg_eviltransform. - Jenks inputs must be finite and
breaksmust be at least one.numericvalues are converted to finitef64, so returned edges are floating-point values. - When the distinct value count does not exceed
breaks, the result is the sorted set of unique values; no valid input rows returnNULL.
0.0.7 Compatibility
The 0.0.6-to-0.0.7 upgrade SQL updates the coordinate-name resolution functions. Upstream supports PostgreSQL 14-18 and PostgreSQL 19 beta4 with pgrx 0.19.3. The ST_JenksBins interface remains unchanged; package/build metadata is maintained separately from the upstream release.
0.0.8 compatibility and safety
Current pgrx 0.20.0 binaries and build headers require at least PostgreSQL 15.20, 16.16, 17.12 or 18.7. PostgreSQL 14 is no longer supported; 19 RC2 support is experimental. This supersedes the older compatibility paragraph above.
Invalid non-geometry transformation input now raises an SQL error instead of crashing. PostGIS functions/types resolve independently of the caller’s search_path. Install matching files, reconnect, and migrate each existing database: