Skip to content

Instantly share code, notes, and snippets.

View andrewharvey's full-sized avatar

Andrew Harvey andrewharvey

View GitHub Profile
@andrewharvey
andrewharvey / generate-map-previews.sh
Created December 20, 2011 10:25
HTML pages for my dev/demo site.
#!/bin/sh
# dimensions of the preview images
WIDTH=400
HEIGHT=200
# the spot we use for the OSMT preview
OSMT_X=151.12508
OSMT_Y=-34.04459
OSMT_Z=16
@andrewharvey
andrewharvey / make-osm-coastline-extract.sh
Created December 24, 2011 09:13
Reduce the size of OSM coastline SHAPE files given a bounding box.
#!/bin/sh
# This script uses ogr2ogr to filter a SHAPE file to within a given bounding
# box, where the SHAPE file is in the Google Maps projection and the bounding
# box is given in WGS84.
# Specifically designed for reducing the size of OpenStreetMap shoreline_300
# and processed_p files.
CITY="NSW"
@andrewharvey
andrewharvey / README.md
Created January 8, 2012 00:07
Incrementally patch a base .osm file with several .osc files.

#About These scripts are designed to consume an existing OSM minute-replicate (as produced by Osmosis) on the local file system and apply these diffs to an existing .osm extract, thereby patching your .osm file with the changes present in the minute-replicate. These scripts are simply wrappers around Osmosis.

These scripts don't apply each one minute .osc.gz file individually to the .osm extract, rather they group together a bunch of one minute files together and applies that bunch at once to your .osm extract.

@andrewharvey
andrewharvey / natmap-index2osm.pl
Created January 19, 2012 09:14
This script converts the mapdata.txt index file given on the AUSLIG NATMAP digital national 1:250000 topographic map series, into a .osm format.
#!/usr/bin/perl -w
# Info: This script converts the mapdata.txt index file given on the AUSLIG
# NATMAP digital national 1:250000 topographic map series, into a .osm
# format.
# Author: Andrew Harvey (http://andrewharvey4.wordpress.com/)
#
# To the extent possible under law, the person who associated CC0
# with this work has waived all copyright and related or neighboring
# rights to this work.
@andrewharvey
andrewharvey / osmtiles2kml.pl
Created January 19, 2012 09:31
This CGI script is an adapter for getting OSM slippy map tiles into Google Earth.
#!/usr/bin/perl -wT
# This CGI script is an adapter for getting OSM slippy map tiles into Google
# Earth.
# I use the onStop view refresh mode to serve a KML file containing all the OSM
# OSM tiles you need for the current view from Google Earth. This approach
# differs from the top down pyramid approach used by TileCache.
# Author: Andrew Harvey <andrew.harvey4@gmail.com>
@andrewharvey
andrewharvey / Makefile
Created January 22, 2012 01:32
Pulls data from http://data.gov.au/dataset/diisr-locations/ and converts to OSM format.
# Author: Andrew Harvey (http://andrewharvey4.wordpress.com/)
#
# To the extent possible under law, the person who associated CC0
# with this work has waived all copyright and related or neighboring
# rights to this work.
# http://creativecommons.org/publicdomain/zero/1.0/
FILE="DIISR_Locations_Nov2011"
all : clean download convert
@andrewharvey
andrewharvey / countTiles.py
Created January 25, 2012 09:23
Given a WGS84 bounding box and an OSM tile zoom range calculates a total number of tiles.
#!/usr/bin/python
# This script should be considered CC0 licensed
# the deg2num function is from http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#lon.2Flat_to_tile_numbers_2
import math
def deg2num(lat_deg, lon_deg, zoom):
lat_rad = math.radians(lat_deg)
n = 2.0 ** zoom
@andrewharvey
andrewharvey / nearmap-to-josm-imagery.pl
Created January 28, 2012 02:27
CGI program which generates a JOSM imagery XML file for NearMap PhotoMaps for a given location.
#!/usr/bin/perl -wT
# This CGI application given a lat and lon, will query nearmap.com for available
# PhotoMaps at that location and return them as a JOSM standard map source xml
# document in the schema as defined at http://josm.openstreetmap.de/maps-1.0
#
# This script is licensed CC0 by Andrew Harvey <andrew.harvey4@gmail.com>
#
# To the extent possible under law, the person who associated CC0
# with this work has waived all copyright and related or neighboring
@andrewharvey
andrewharvey / Gazetteer2010_txt.vrt
Last active September 30, 2015 22:57
Convert Geoscience Australia Gazetteer 2010 into the OSM XML format
<OGRVRTDataSource>
<OGRVRTLayer name="Gazetteer2010_txt">
<SrcDataSource>Gazetteer2010_txt.txt</SrcDataSource>
<GeometryType>wkbPoint</GeometryType>
<LayerSRS>GDA94</LayerSRS>
<GeometryField encoding="PointFromColumns" x="LONGITUDE" y="LATITUDE"/>
</OGRVRTLayer>
</OGRVRTDataSource>
@andrewharvey
andrewharvey / Makefile
Created March 18, 2012 07:32
XSL to convert abc-local-radio.xml to an XML OSM format.
# Author: Andrew Harvey (http://andrewharvey4.wordpress.com/)
#
# To the extent possible under law, the person who associated CC0
# with this work has waived all copyright and related or neighboring
# rights to this work.
# http://creativecommons.org/publicdomain/zero/1.0/
FILE_NAME=abc-local-radio
all : clean download convert