Skip to content

Instantly share code, notes, and snippets.

@dwins
dwins / start_clean_gs.sh
Created March 17, 2010 20:19
Shell commands to start up GeoServer with a fresh datadir every time
# run in the geoserver webapp dir:
cd geoserver/src/web/app/
# If you use SVN
rm -rf /tmp/release
svn export ../../../data/release/ /tmp/release/
mvn jetty:run -DGEOSERVER_DATA_DIR=/tmp/release/
# if you use git-svn
git clean -xdf -- ../../../data/release/
user = "admin"
pass = "geoserver"
gs_url = "localhost:8080/geoserver"
workspace = "floods"
system( "curl -u #{user}:#{pass} -v -XPOST -H 'Content-type: text/xml' -d '<workspace><name>#{workspace}</name></workspace>' #{gs_url}/rest/workspaces")
system("mkdir -p tmp_expanded")
system("mkdir -p geotiffs")
Dir.glob('*.zip').each{ |z| system( "unzip -n #{z} -d ./tmp_expanded")}
#!/bin/bash
#s3togs.sh
# This script takes a list of zipfiles on a plain text file, downloads them and pushes
# them to geoserver.
LINKSFILE=whitelist.txt
BUCKET_URL=https://s3.amazonaws.com/haitidata/
GEOSERVER_CREDENTIALS=adminuser:supersecretpass
GEOSERVER_BASE_URL=http://geonode.mycompany.com/geoserver/
DEFAULT_WORKSPACE=base
if [ -f "$LINKSFILE" ]
@uniomni
uniomni / gist:779194
Created January 14, 2011 04:56
Geoserver REST command examples

REST commands, generated by Risk-in-a-Box and known to work

Upload shapefile + associated style. Then activate style and make it default.

PUT -H "Content-type: application/zip" "http://localhost:8080/geoserver/rest/workspaces/exposure/datastores/AIBEP_schools/file.shp" --data-binary "@AIBEP_schools.zip"
POST -H "Content-type: text/xml" "http://localhost:8080/geoserver/rest/styles" --data-ascii "<style>AIBEP_schoolsAIBEP_schools.sld</style>"
PUT -H "Content-type: application/vnd.ogc.sld+xml" "http://localhost:8080/geoserver/rest/styles/AIBEP_schools" --data-binary "@AIBEP_schools.sld"
PUT -H "Content-type: text/xml" "http://localhost:8080/geoserver/rest/layers/AIBEP_schools" --data-ascii "AIBEP_schoolstrue"

@spara
spara / opengeo-suite-install.sh
Created March 22, 2011 20:07
OpenGeo Suite installer for Ubuntu with Apache proxy configured
#!/bin/bash
# setup repository
sudo wget -qO- http://apt.opengeo.org/gpg.key | apt-key add -
sudo chmod 655 /etc/apt/sources.list
sudo echo "deb http://apt.opengeo.org/ubuntu lucid main" >> /etc/apt/sources.list
sudo chmod 644 /etc/apt/sources.list
sudo apt-get update
# install opengeo suite
@jacobandresen
jacobandresen / mod_proxy geoserver
Created June 2, 2011 15:53
mod_proxy geoserver
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass /geoserver http://localhost:8080/geoserver
ProxyPreserveHost On
ProxyStatus On
@wojdyr
wojdyr / mbox_send.py
Created August 28, 2011 08:14
script to send all messages in an mbox file to a specific email address, with various options
#!/usr/bin/python
"""\
A command-line utility that can (re)send all messages in an mbox file
to a specific email address, with options for controlling the rate at
which they are sent, etc.
"""
# I got this script from Robin Dunn a few years ago, see
# https://github.com/wojdyr/fityk/wiki/MigrationToGoogleGroups
@leplatrem
leplatrem / gist:1415767
Created December 1, 2011 10:47
Leaflet Offline Tiles using SQL Storage
/*
* L.TileLayer.LocalCache : A tile layer using SQL Storage, if available.
*/
L.TileLayer.LocalCache = L.TileLayer.extend({
options: {
minZoom: 0,
maxZoom: 18,
tileSize: 256,
subdomains: 'abc',
@dwins
dwins / switch-on-env.sld.xml
Created December 29, 2011 18:55
Switch off rules in GeoServer styles based on query parameters
<?xml version="1.0" encoding="UTF-8"?>
<sld:UserStyle xmlns="http://www.opengis.net/sld"
xmlns:sld="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc"
xmlns:gml="http://www.opengis.net/gml">
<sld:Name>Default Styler</sld:Name>
<sld:Title/>
<sld:FeatureTypeStyle>
<sld:Name>name</sld:Name>
<sld:Rule>
<ogc:Filter>
@nhoizey
nhoizey / screenshots.js
Created November 12, 2012 17:07
Take screenshots at different viewport sizes using CasperJS
/*
* Takes provided URL passed as argument and make screenshots of this page with several viewport sizes.
* These viewport sizes are arbitrary, taken from iPhone & iPad specs, modify the array as needed
*
* Usage:
* $ casperjs screenshots.js http://example.com
*/
var casper = require("casper").create();