This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 [email protected] | |
# 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 hidden or 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 osgeo import ogr | |
def kml2geojson(kml_file): | |
drv = ogr.GetDriverByName('KML') | |
kml_ds = drv.Open(kml_file) | |
for kml_lyr in kml_ds: | |
for feat in kml_lyr: | |
print feat.ExportToJson() | |
kml2geojson('/path/to/your.kml') |
NewerOlder