Skip to content

Instantly share code, notes, and snippets.

View wrobstory's full-sized avatar

Rob Story wrobstory

View GitHub Profile
@wrobstory
wrobstory / shapefile_to_json.py
Created May 2, 2013 05:38
Shapefile to geoJSON with Ogre and Python Requests
def shapefile_to_json(self, shp_path=None, json_out=None):
'''Write a shapefile to geoJSON via Ogre
Make a HTTP POST request to the Ogre converter:
http://ogre.adc4gis.com/ to transform shapefiles
to geoJSON for Vincent.
Parameters:
-----------
shp_path: string, default None
@wrobstory
wrobstory / a_stock_example.py
Last active December 17, 2015 00:48
Bearcart Line Plot
# -*- coding: utf-8 -*-
'''
An example for Bearcart
'''
import bearcart
import pandas as pd
html_path = r'index.html'
data_path = r'stock_data.json'
@wrobstory
wrobstory / an_area_example.py
Last active December 17, 2015 00:48
Bearcart Area Plot
# -*- coding: utf-8 -*-
'''
An example for Bearcart Area plotting
'''
import bearcart
import pandas as pd
html_path = r'index.html'
data_path = r'stock_data.json'
@wrobstory
wrobstory / a_scatter_example.py
Last active December 17, 2015 00:48
Bearcart Scatter Plot
# -*- coding: utf-8 -*-
'''
An example for Bearcart Area plotting
'''
import bearcart
import pandas as pd
html_path = r'index.html'
data_path = r'stock_data.json'
@wrobstory
wrobstory / area_example.py
Last active December 17, 2015 02:48
Bearcart Area (Non Timeseries)
import random
import bearcart
import pandas as pd
html_path = r'index.html'
data_path = r'random_data.json'
js_path = 'rickshaw.min.js'
css_path = 'rickshaw.min.css'
tabular_data_1 = [random.randint(10, 100) for x in range(0, 25, 1)]
@wrobstory
wrobstory / bar_example.py
Last active December 17, 2015 02:48
Bearcart Bar (Non Timeseries)
import random
import bearcart
import pandas as pd
html_path = r'index.html'
data_path = r'random_data.json'
js_path = 'rickshaw.min.js'
css_path = 'rickshaw.min.css'
tabular_data_1 = [random.randint(10, 100) for x in range(0, 25, 1)]
@wrobstory
wrobstory / folium_OSM.py
Last active December 17, 2015 03:48
Folium OpenStreetMap Base
# -*- coding: utf-8 -*-
'''Test of Folium basic OSM map'''
import folium
#Standard OSM
map = folium.Map(location=[45.5236, -122.6750])
map.create_map()
@wrobstory
wrobstory / folium_mapbox.py
Last active December 17, 2015 03:48
Folium MapBox Control Room Base
# -*- coding: utf-8 -*-
'''Test of Folium MapBox Control Room'''
import folium
#Standard MapBox Control Room (Dark)
map = folium.Map(location=[45.5236, -122.6750], tiles='MapBox Dark',
zoom_start=4, max_zoom=8)
map.create_map()
@wrobstory
wrobstory / README.md
Last active December 17, 2015 04:39
Folium Simple Markers

A terrain map with two markers generated by Folium. Click on the markers for popover information. This map was generated with the following Python code:

#Mt Hood, with Mapbox custom tiles
tileset = r'http://a.tiles.mapbox.com/v3/wrobstory.map-ze418b98/{z}/{x}/{y}.png'
map = folium.Map(location=[45.372, -121.6972], zoom_start=12, 
                 tiles=tileset)
map.simple_marker([45.3288, -121.6625], popup_txt='Mt. Hood Meadows')
map.simple_marker([45.3311, -121.7113], popup_txt='Timberline Lodge')
map.create_map()
@wrobstory
wrobstory / README.md
Last active December 17, 2015 05:38
Folium Markers with Lat/Lng Popovers

A custom Mapbox map generated by Folium. One fixed marker, one fixed circle marker. Click on the map to place a new marker, click the marker to see Lat/Lng, double-click the marker to remove it. This map was generated with the following Python code:

import folium

#Custom Mapbox Tiles
tileset = r'http://a.tiles.mapbox.com/v3/[...]/{z}/{x}/{y}.png'
attribution = (r'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a>'
                ' contributors, Imagery © <a href="http://mapbox.com">MapBox</a>')
#Create Map
mapbox = folium.Map(location=[45.5236, -122.6750], tiles=tileset, zoom_start=13,