Skip to content

Instantly share code, notes, and snippets.

View invisiblefunnel's full-sized avatar

Danny Whalen invisiblefunnel

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import utm
from shapely.geometry import Point
def bbox_from_point(point, meters):
easting, northing, zn, zl = utm.from_latlon(point.y, point.x)
point = Point(easting, northing)
bounds = point.buffer(meters).bounds
minx, miny, maxx, maxy = bounds
result = []
for e, n in ((minx, miny), (maxx, maxy)):

Filter ways

osmosis \
  --read-pbf-fast ~/Desktop/planet-190909.osm.pbf \
  --log-progress \
  --buffer \
  --tag-filter accept-ways highway=* \
  --tag-filter reject-ways highway=cycleway,motor,proposed,construction,abandoned,platform,raceway \
 --tag-filter reject-ways area=yes \
package main
import (
"fmt"
"github.com/lukeroth/gdal"
"github.com/paulmach/orb"
"github.com/paulmach/orb/project"
)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
from contextlib import contextmanager
import os
import subprocess
import tempfile
@contextmanager
def maybe_download_remote(url_or_path, **kwargs):
"""
Adapted from: https://git.io/fxMdS
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@invisiblefunnel
invisiblefunnel / howto.md
Created July 3, 2018 03:10
Geopackage to PostGIS via ogr2ogr
ogr2ogr -nlt PROMOTE_TO_MULTI \
        -t_srs 'EPSG:4326' \
        -overwrite \
        -lco SCHEMA=public \
        -lco PRECISION=NO \
        --config PG_USE_COPY YES \
        -f PostgreSQL PG:$(heroku config:get DATABASE_URL -a myapp) \
        ~/Downloads/natural_earth_vector.gpkg/packages/natural_earth_vector.gpkg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.