Skip to content

Instantly share code, notes, and snippets.

View robgaston's full-sized avatar

Rob Gaston robgaston

View GitHub Profile
@robgaston
robgaston / __arches_get_json_data_for_view.sql
Created April 18, 2023 18:33
Fix for "Importing data with null geometries - Relational Views and SQL ETL Methods"
create or replace function __arches_get_json_data_for_view(
view_row anyelement,
schema_name text,
view_name text
) returns json as $$
declare
column_info record;
query text;
result jsonb;
geom geometry;
@robgaston
robgaston / add-example-points-layer.sh
Created January 29, 2018 17:36
example of how to add a geojson points layer to arches
python manage.py packages -o add_mapbox_layer -n example-points-1 -j example-points.json
-- insert into tiles(tiledata, nodegroupid, resourceinstanceid)
-- values ('{
-- "2d18cb13-d175-47d6-b218-8f2644cf8b3c": {
-- "type": "Point",
-- "coordinates": [100.0, 0.0]
-- }
-- }','2d18cb13-d175-47d6-b218-8f2644cf8b3c', '40000000-0000-0000-0000-000000000000');
select
t.tileid,
@robgaston
robgaston / client.js
Created June 6, 2016 20:44
Arches - converting WKT to GeoJSON
require(['openlayers'], function (ol) {
var wkt = 'POLYGON ((-77.0199645623452080 38.9367434431880500, -77.0170892342812290 38.9348073023232930, -77.0130981072670690 38.9378116362101990, -77.0173896416908970 38.9389799539040380, -77.0193250499710590 38.9372989139861830, -77.0199645623452080 38.9367434431880500))';
var wktFormat = new ol.format.WKT();
var geoJSONFormat = new ol.format.GeoJSON();
var geom = wktFormat.readGeometry(wkt);
var geoJSON = geoJSONFormat.writeGeometry(geom);
console.log(geoJSON);
});
# install deps via homebrew
brew update
brew install elasticsearch
brew install postgres
brew install postgis
brew install gdal
# configure es & pg to launch on startup
mkdir -p ~/Library/LaunchAgents
ln -sfv /usr/local/opt/elasticsearch/*.plist ~/Library/LaunchAgents
@robgaston
robgaston / README.md
Last active May 23, 2016 21:53 — forked from wboykinm/README.md
geosnap

Playing around with the idea of snapping to a latlon grid, by rounding the latlon values of my mouse coordinates to 1 decimal place.

Not exactly sure how this will be useful, but it could be an interesting way to interact with a values binned to a grid on the globe.

Built with blockbuilder.org

forked from enjalot's block: geosnap

forked from anonymous's block: geosnap

@robgaston
robgaston / countries.json
Last active August 29, 2015 14:21
countries.json
[{"name":"Afghanistan","latitude":34.80365353623189,"longitude":67.6910866231884},{"name":"Angola","latitude":-10.239707480000003,"longitude":16.840492466666667},{"name":"Albania","latitude":41.27321845454546,"longitude":20.10958809090909},{"name":"United Arab Emirates","latitude":24.195379136363634,"longitude":54.243401318181824},{"name":"Argentina","latitude":-38.53493061983472,"longitude":-65.31775947933885},{"name":"Armenia","latitude":40.0615628,"longitude":45.164243549999995},{"name":"Antarctica","latitude":-73.30915780243174,"longitude":-16.46066841489363},{"name":"French Southern and Antarctic Lands","latitude":-49.11861111111111,"longitude":69.46083333333334},{"name":"Australia","latitude":-25.008417136929427,"longitude":134.25797787136926},{"name":"Austria","latitude":47.64469881081084,"longitude":13.484573189189193},{"name":"Azerbaijan","latitude":40.15540813636364,"longitude":47.00665347727273},{"name":"Burundi","latitude":-3.3942826923076925,"longitude":29.95537653846154},{"name":"Belgium","latit
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@robgaston
robgaston / glstyle.json
Last active August 29, 2015 14:21
testing a mapbox gl style...
{
"version": 7,
"name": "Mapbox Outdoors",
"constants": {
"@name": "{name_en}",
"@sans_lt": "Open Sans Regular, Arial Unicode MS Regular, Arial Unicode MS Bold",
"@sans": "Open Sans Semibold, Arial Unicode MS Bold",
"@sans_italic": "Open Sans Semibold Italic, Arial Unicode MS Bold",
"@land": "#808080",
"@water": "#808080",
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.