Last active
April 27, 2021 15:15
-
-
Save tuesd4y/4ed1257d0cf848e792a55d40d277ab29 to your computer and use it in GitHub Desktop.
IntelliJ custom postfix templates - depends on https://plugins.jetbrains.com/plugin/9862-custom-postfix-templates being installed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Custom postfix templates useful for postgis functions - created by tuesd4y | |
# see www.tuesd4y.com | |
.trans : transform geometry into WG84 (=SRID 4326) | |
ANY -> ST_TRANSFORM($expr$, 4326) | |
.transform : transform geometry into another CRS | |
ANY -> ST_TRANSFORM($expr$, $NAME#1::4326$) | |
.trans3 : transform geometry into 3035 lambert azimuthal covering europe | |
ANY -> ST_TRANSFORM($expr$, 3035) | |
.feature : build json feature out of geometry | |
ANY -> json_build_object(\ | |
'type', 'Feature',\ | |
'geometry', ST_AsGeoJSON($expr$)::json,\ | |
'properties', json_build_object($END$)\ | |
) | |
.featureTransform : build json feature out of geometry that isn't yet 4326 CRS | |
ANY -> json_build_object(\ | |
'type', 'Feature',\ | |
'geometry', ST_AsGeoJSON(ST_TRANSFORM($expr$, 4326))::json,\ | |
'properties', json_build_object($END$)\ | |
) | |
.featureCollection : build feature collection out of multiple geometry records | |
ANY -> json_build_object(\ | |
'type', 'FeatureCollection',\ | |
'features', json_agg(json_build_object(\ | |
'type', 'Feature',\ | |
'geometry', ST_AsGeoJSON($expr$)::json,\ | |
'properties', json_build_object($END$)\ | |
))\ | |
) | |
.gmaps : get google maps link for geometry | |
ANY -> 'https://www.google.at/maps/place/' || st_y($expr$) || ',' || st_x($expr$) | |
.geojsonio : get geojsonio link for geometry | |
ANY -> 'http://geojson.io/#data=data:application/json,' || json_build_object(\ | |
'type', 'FeatureCollection',\ | |
'features', json_agg(json_build_object(\ | |
'type', 'Feature',\ | |
'geometry', ST_AsGeoJSON(ST_TRANSFORM($expr$, 4326))::json,\ | |
'properties', json_build_object()\ | |
))\ | |
)::text |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment