Skip to content

Instantly share code, notes, and snippets.

View talllguy's full-sized avatar
🎯
Focusing

Elliott Plack talllguy

🎯
Focusing
View GitHub Profile
@talllguy
talllguy / mapillary_arcade_url.js
Last active July 31, 2019 03:13
Arcade JS to return Mapillary map for given point
function MetersToLatLon(x, y) {
// Converts XY point from Spherical Mercator EPSG:900913 to lat/lon in WGS84 Datum
// Source: http://www.maptiler.org/google-maps-coordinates-tile-bounds-projection/
// Source: https://community.esri.com/thread/222695-latlong-unit-conversion-with-arcade#comment-806053
var originShift = 2.0 * PI * 6378137.0 / 2.0;
var lon = (x / originShift) * 180.0;
var lat = (y / originShift) * 180.0;
lat = 180.0 / PI * (2.0 * Atan( Exp( lat * PI / 180.0)) - PI / 2.0);
@talllguy
talllguy / apple_arcade_URL_gen.js
Created June 4, 2019 12:29
Arcade expression for generating an Apple Maps directions link at a point
function MetersToLatLon(x, y) {
// Converts XY point from Spherical Mercator EPSG:900913 to lat/lon in WGS84 Datum
// Source: http://www.maptiler.org/google-maps-coordinates-tile-bounds-projection/
// Source: https://community.esri.com/thread/222695-latlong-unit-conversion-with-arcade#comment-806053
var originShift = 2.0 * PI * 6378137.0 / 2.0;
var lon = (x / originShift) * 180.0;
var lat = (y / originShift) * 180.0;
lat = 180.0 / PI * (2.0 * Atan( Exp( lat * PI / 180.0)) - PI / 2.0);
@talllguy
talllguy / google_maps_arcade_URL_gen.js
Last active December 6, 2021 20:55
Arcade expression for generating a Google Maps directions link at a point
function MetersToLatLon(x, y) {
// Converts XY point from Spherical Mercator EPSG:900913 to lat/lon in WGS84 Datum
// Source: http://www.maptiler.org/google-maps-coordinates-tile-bounds-projection/
// Source: https://community.esri.com/thread/222695-latlong-unit-conversion-with-arcade#comment-806053
var originShift = 2.0 * PI * 6378137.0 / 2.0;
var lon = (x / originShift) * 180.0;
var lat = (y / originShift) * 180.0;
lat = 180.0 / PI * (2.0 * Atan( Exp( lat * PI / 180.0)) - PI / 2.0);
return [lat, lon];
@talllguy
talllguy / waze_arcade_URL_gen.js
Created June 4, 2019 12:23
Arcade expression for generating a Waze directions link at a point
function MetersToLatLon(x, y) {
// Converts XY point from Spherical Mercator EPSG:900913 to lat/lon in WGS84 Datum
// Source: http://www.maptiler.org/google-maps-coordinates-tile-bounds-projection/
// Source: https://community.esri.com/thread/222695-latlong-unit-conversion-with-arcade#comment-806053
var originShift = 2.0 * PI * 6378137.0 / 2.0;
var lon = (x / originShift) * 180.0;
var lat = (y / originShift) * 180.0;
lat = 180.0 / PI * (2.0 * Atan( Exp( lat * PI / 180.0)) - PI / 2.0);
@talllguy
talllguy / gsv_arcade_point.js
Last active June 15, 2023 13:31
Arcade expression that returns a Google Street View link for a given feature.
// =================================================================== //
// Arcade Google Street View Point //
// by Elliott Plack (eplack@mdot.maryland.gov) //
// Description: //
// ArcGIS Arcade expression that returns a Google Street View URL //
// at a point's location. Add it to the point layer's attributes and //
// then reference the link as a URL in the popup. //
// =================================================================== //
function MetersToLatLon(x, y) {
@talllguy
talllguy / explorer_arcade.js
Last active October 5, 2019 00:58
Arcade function to call CONNECTExplorer URL of a point in web map that is projected in meters.
function MetersToLatLon(x, y) {
// Converts XY point from Spherical Mercator EPSG:900913 to lat/lon in WGS84 Datum
// Source: http://www.maptiler.org/google-maps-coordinates-tile-bounds-projection/
// Source: https://community.esri.com/thread/222695-latlong-unit-conversion-with-arcade#comment-806053
var originShift = 2.0 * PI * 6378137.0 / 2.0;
var lon = (x / originShift) * 180.0;
var lat = (y / originShift) * 180.0;
lat = 180.0 / PI * (2.0 * Atan( Exp( lat * PI / 180.0)) - PI / 2.0);
@talllguy
talllguy / index.html
Last active May 24, 2019 19:03
Facilities popup with explorer URL
<div style="text-align: right;"><font size="2"><img alt="MDOT Logo" src="https://geo.sha.maryland.gov/images/maryland_MDOT_logo_CMYK_croppedtran75.png" /><br />
</font></div>
<div style="text-align: center;"><font size="2"><font face="Arial, Helvetica, sans-serif">
{Address}<br />
{City}, {State}  {ZIP_Code}<br />
<font color="#8b0000" style=""><a href="{expression/expr0}" style="font-weight: bold;"><font color="#8b0000">View in Connect Explorer Imagery</font><br /></a>(</font></font><a href="mailto:GIS@mdot.maryland.gov?subject=Request%20for%20Oblique%20Imagery%20Access" target="_blank"><font color="#8b0000">Request Access</font></a><font face="Arial, Helvetica, sans-serif" style=""><font color="#8b0000" style="">)<br /><b> </b></font></font></font></div><font face="Arial, Helvetica, sans-serif"><font size="2">
</font><font face="Arial, Helvetica, sans-serif" style=""><font size="2">
<u>MDOT SHA ID#</u>: {SHA_ID_Number}<br />
<u>FMIS ID#</u>:{ID_Number}<br />
<u>MDOT SHA District</u>: {SHA_District}<br />
@talllguy
talllguy / ogr2ogr_multiple_shapes_to_fgdb.bat
Created April 11, 2019 12:31
Batch ogr2ogr script that combines multiple shapefiles in a folder into one geodatabase layer
REM Replace `gdb_name.gdb` and `name_of_layer` with your own names
REM Citation: https://gis.stackexchange.com/a/283981/15499
for %f in (*.shp) do (if not exist test.gdb (ogr2ogr -progress --config shape_encoding "UTF-8" -f "filegdb" gdb_name.gdb %f -nln name_of_layer -lco encoding="UTF-8") Else (ogr2ogr --config shape_encoding "UTF-8" -progress -f "filegdb" -update -append gdb_name.gdb %f -nln name_of_layer -lco encoding="UTF-8"))
@talllguy
talllguy / GDBdomainsToXLSX.py
Created July 18, 2018 03:41
Python script that outputs Excel (XLSX) files for all domains in a geodatabase. It is designed to run at the ArcGIS Pro command line.
## Specify the File Geodatabase workspace
gdb = "C:\\Users\\XXXXXXXX\\Documents\\ArcGIS\\Projects\\XXXX.gdb"
## Get a list of domains
desc = arcpy.Describe(gdb)
domains = desc.domains
## Loop over the list of domains
for domain in domains:
## Create an object that represents the name of the Excel file to be created