Set up the cfg file with
profiles=apiso,fgdc
and intialized the database
python sbin/pycsw-admin.py -c setup_db -f default.cfg
import numpy as np | |
from scipy.spatial import KDTree | |
from fiona import collection | |
def nearest_features(datasource, x, y, n=1): | |
""" | |
datasource: The ogr datasource path | |
x, y: coordinates to query for nearest | |
n: number of features (default = 1 or the single nearest feature) |
#Global search and replace: | |
grep -lr -e 'oldtext' * | xargs sed -i 's/oldtext/newtext/g' |
# courtesy of @eknuth | |
# Watches for media changes and runs the install_media command (equivalent of collectstatic) | |
while true | |
do | |
inotifywait -r -e modify -e move -e create -e delete ../media ~/proj/env/src/madrona/media/ | while read line | |
do | |
python manage.py install_media | |
done | |
done |
Set up the cfg file with
profiles=apiso,fgdc
and intialized the database
python sbin/pycsw-admin.py -c setup_db -f default.cfg
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>CartoDB/OpenLayers Demo</title> | |
<link rel="stylesheet" href="http://openlayers.org/dev/theme/default/style.css" type="text/css"> | |
<style> | |
html, body { | |
width: 100%; | |
height: 100%; | |
} |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>mperry Line Charts</title> | |
<link class="include" rel="stylesheet" type="text/css" href="../jquery.jqplot.min.css" /> | |
<!--[if lt IE 9]><script language="javascript" type="text/javascript" src="../excanvas.js"></script><![endif]--> | |
<script class="include" type="text/javascript" src="../jquery.min.js"></script> | |
<script class="include" type="text/javascript" src="../jquery.jqplot.min.js"></script> | |
<script class="include" type="text/javascript" src="../plugins/jqplot.canvasTextRenderer.min.js"></script> |
""" | |
Web Mercator Scale and Resolution Calculations | |
Python implementation of the formulas at http://msdn.microsoft.com/en-us/library/bb259689.aspx | |
""" | |
import math | |
def meters_per_pixel(zoom, lat): | |
""" | |
ground resolution = cos(latitude * pi/180) * earth circumference / map width | |
""" |
import numpy as np | |
rawpoints = np.array( | |
[[2500, 0.15, 12], | |
[1200, 0.65, 20], | |
[6200, 0.35, 19]] | |
) | |
# Scale the rawpoints array so that each "column" is | |
# normalized to the same scale |
# -*- coding: utf-8 -*- | |
""" | |
Runs a simple pubsub listener which pushes to clients via sockjs | |
Based on https://gist.github.com/mrjoes/3284402 | |
Eventually I'd like to have one redis connection listening on user_* channel | |
and pushing messages ONLY to that user's client. Currently it just sends | |
a message to everyone. | |
Setup: |
Create ArcGIS-style Union and Identity non-overlapping polygon layers | |
from multiple input polygon tables (potentially overlapping) while retaining original attributes. | |
http://webhelp.esri.com/arcgisdesktop/9.2/index.cfm?TopicName=Union_(Analysis) | |
http://webhelp.esri.com/arcgisdesktop/9.2/index.cfm?TopicName=identity_(analysis) | |
http://gis.stackexchange.com/questions/83/separate-polygons-based-on-intersection-using-postgis/121 |