Skip to content

Instantly share code, notes, and snippets.

View brambow's full-sized avatar

brambow brambow

View GitHub Profile
@brambow
brambow / arcpy_data_dictionary.py
Created May 22, 2018 13:58
Create a Data Dictionary for ArcGIS Pro Feature Classes
# generate a data dictionary from an ArcGIS feature class
# tested with ArcGIS Pro/Python3
# Run from command prompt in ArcGIS Pro environment
# Takes 2 arguments: 1) path to feature class 2) path for output CSV file
# Example: python C:\arcpy_data_dictionary.py C:\yourgeodatabase.gdb\featureclassname C:\output.csv
import arcpy
import sys
import csv
module.exports = function PostGisPlugin(builder) {
builder.hook(
'GraphQLObjectType:fields',
(
fields, // Input object
{ extend,
pgGetGqlTypeByTypeId,
pgIntrospectionResultsByKind: introspectionResultsByKind,
pgSql: sql,
pg2gql,
@brambow
brambow / postgis-to-geojson-feature-collection.sql
Last active April 25, 2023 15:44
PostGIS query to build a GeoJSON FeatureCollection
SELECT json_build_object(
'type', 'FeatureCollection',
'crs', json_build_object(
'type', 'name',
'properties', json_build_object(
'name', 'EPSG:4326'
)
),
'features', json_agg(
json_build_object(
@brambow
brambow / PostgresDataDictionary.sql
Created August 30, 2017 18:42
PostgreSQL Data Dictionary
SELECT DISTINCT ON
( table_schema, table_name, ordinal_position ) table_schema,
table_name,
ordinal_position,
column_name,
data_type,
column_default,
is_nullable,
pg_description.description
FROM