Skip to content

Instantly share code, notes, and snippets.

View pauldzy's full-sized avatar

Paul Dziemiela pauldzy

View GitHub Profile
@pauldzy
pauldzy / wqp_harvest.py
Last active November 10, 2023 15:04
WQP Harvest
import os,sys;
import requests,csv,codecs;
localdir = os.path.dirname(os.path.abspath(__file__));
target = localdir + os.sep + 'wqp_harvest_20230925.csv';
if os.path.exists(target):
os.remove(target);
r = requests.get('https://www.waterqualitydata.us/Codes/countrycode?mimeType=json');
import requests;
url = "https://echo.epa.gov/files/echodownloads/npdes_biosolids_downloads.zip";
target = r"npdes_biosolids_downloads.zip";
print("\nQuerying " + str(url) + "...\n");
step1 = requests.get(
url
,allow_redirects=False
);
@pauldzy
pauldzy / notify_ddl_postgrest.sql
Created August 14, 2019 14:45
Alternative notify_ddl_postgrest event trigger
CREATE OR REPLACE FUNCTION public.notify_ddl_postgrest()
RETURNS event_trigger
AS $$
DECLARE
obj RECORD;
BEGIN
FOR obj IN SELECT * FROM pg_event_trigger_ddl_commands()
LOOP
IF obj.object_type IN ('type','function','procedure')
THEN
@pauldzy
pauldzy / arcgis_pro_deploy_map_service.py
Created August 3, 2019 14:41
Python 3 arcpy script to automate the deployment of ArcGIS Pro defined map services to standalone ArcGIS Servers
import os,sys,arcpy;
import xml.dom.minidom as DOM;
###############################################################################
# Alter the following constants as required
###############################################################################
project_name = "HydrologicUnits";
ags_service = "HydrologicUnits";
ags_folder = "Support";
@pauldzy
pauldzy / apex_geojson2sdo.prc
Last active June 24, 2019 23:36
APEX_JSON GeoJSON to SDO_GEOMETRY Utility
CREATE OR REPLACE PROCEDURE apex_geojson2sdo(
pInput IN CLOB
,pOutput OUT MDSYS.SDO_GEOMETRY
,pReturnCode OUT INTEGER
,pStatusMessage OUT VARCHAR2
)
AUTHID CURRENT_USER
AS
l_values APEX_JSON.T_VALUES;
str_test VARCHAR2(4000 Char);
{
"objectIdFieldName" : "OBJECTID",
"globalIdFieldName" : "GlobalID",
"geometryType" : "esriGeometryPoint",
"spatialReference" : {
"wkid" : 102100,
"latestWkid" : 3857
},
"fields" : [
{
@pauldzy
pauldzy / extract_feature_service.py
Last active August 28, 2019 17:38
ArcPy script to extract feature classes from feature and map services
import arcpy,os,http.client,json
############################################
# Edit these items per the service to scrape
host = "gispub.epa.gov";
service_path = "/arcgis/rest/services/OAR/USEPA_NEI_2005/MapServer/0"
output_fgdb = r"c:\esri_dump\fg.gdb";
output_fc = "USEPA_NEI_2005"
@pauldzy
pauldzy / datapump_export.sql
Created August 23, 2017 19:27
Generic datapump scripts
DECLARE
num_handle NUMBER;
str_filename VARCHAR2(2000 Char);
clb_tablelist CLOB;
str_directory VARCHAR2(30 Char) := 'LOADING_DOCK';
BEGIN
str_filename := 'waters_cip_OWPUB_20170823';
--Note you must single quote the table items
@pauldzy
pauldzy / map.geojson
Last active August 29, 2015 14:06
Interwar Poland 1934 Towns
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.