This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pandas import read_csv | |
df = read_csv(open('zimbabwe.csv')) | |
columns = ('apr_09','jul_09','sep_09','jan_10','apr_10','jul_10','dec_10','apr_11','jul_11','sep_11','dec_11','mar_12','jul_12','Sep-12','Dec-12','feb_mar13','Jul-13','aug_sep13') | |
group_field = 'DISTRICT' | |
joined = df[['DISTRICTPC', group_field]].drop_duplicates() | |
for c in columns: | |
sdf = df[[group_field, c]] | |
result = sdf.groupby([group_field]).agg(lambda x:x.value_counts().index[0]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def add_user_in_registered_group(user): | |
from geonode.groups.models import GroupProfile | |
from geonode.people.models import Profile | |
try: | |
gp = GroupProfile.objects.get(slug='registered') | |
except GroupProfile.DoesNotExist: | |
gp = GroupProfile.objects.create( | |
title=_('Registered GeoNode Users'), | |
slug='registered', | |
description=_('Group containg all of the GeoNode users'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css" /> | |
<script src="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js"></script> | |
<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script> | |
</head> | |
<body> | |
<div id="map" style="width: 800px; height: 600px;"></div> | |
<script type="text/javascript"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare -a fields=("ROADID" "SOURCEID" "NOTES" "ONME" "RTENME" "NTLCLASS" "FCLASS" "NUMLANES" "SRFTPE" "SRFCOND" "SRFPREP" "ISSEASONAL" "CURNTPRAC" "GNRALSPEED" "GDWTHRPRAC" "BDWTHRPRAC" "SHAPE_LENG" "ADM0_CODE" "ADM0_NAME" "CONTINENT" "REGION") | |
shp="was_trs_roads_wfp" | |
for f in "${fields[@]}" | |
do | |
lf=$(echo $f | awk '{print tolower($0)}') | |
echo $lf | |
ogrinfo $shp.shp -sql "ALTER TABLE $shp RENAME COLUMN $f TO $lf" | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NameVirtualHost *:80 | |
<VirtualHost *:80> | |
ServerName localhost | |
ServerAdmin me@example.org | |
# Log Files | |
LogLevel info | |
ErrorLog /var/log/apache2/error-geonode-2.log | |
CustomLog /var/log/apache2/access-geonode-2.log combined | |
DocumentRoot /home/capooti/git/github/capooti/geonode-master/geonode/static_root | |
Alias /static/ /home/capooti/git/github/capooti/geonode-master/geonode/static_root/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ALLDIRS = ['/home/capooti/.venvs/geonode/lib/python2.7/site-packages'] | |
import os | |
import sys | |
import site | |
# Remember original sys.path. | |
prev_sys_path = list(sys.path) | |
# Add each new site-packages directory. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
from geonode.maps.models import Map | |
broken_maps = [2517, | |
2519, | |
2520, | |
2521, | |
2522, | |
2525, | |
2527, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from hypermap.aggregator.models import Layer | |
from hypermap.aggregator.tasks import index_cached_layers | |
from django.core.cache import cache | |
layers = Layer.objects.filter(service__srs__code=102100).filter(is_valid=True) | |
layers_cache = set([0]) | |
for layer in layers: | |
layers_cache.add(layer.id) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd /mydir | |
url="http://localhost:8080/geoserver/wms?STYLES=&FORMAT=image%2Fpng&TRANSPARENT=TRUE&LAYERS=geonode%3ADE01_SL6_22P_1T_20100521T010517_20100521T010602_DMI_0_1b5d_qXM&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&VERSION=1.1.1&SERVICE=WMS&REQUEST=GetMap&LLBBOX=137.36632816178096,36.772883864884584,141.8751878470843,40.26195796778519&URL=http%3A%2F%2Flocalhost%3A8180%2Fgeoserver%2Fwms&TILED=true&TILESORIGIN=15291549.700982,4407496.8300991&SRS=EPSG%3A900913&BBOX=15654303.390625,4657155.2587109,15693439.149102,4696291.0171875&WIDTH=256&HEIGHT=256" | |
/usr/bin/curl $url --connect-timeout 5 --max-time 20 -s -f -o /dev/null | |
if [ $? -eq 0 ] | |
then | |
: | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
from geonode.maps.models import Layer, Map | |
map = Map.objects.get(id=2512) | |
for layer in map.layer_set.filter(ows_url__icontains='worldmap.harvard.edu/geoserver/wms'): | |
if layer.name is None: | |
print 'This layer is None!!!' | |
else: | |
print 'Fixing layer %s' % layer.name |
OlderNewer