Python bindings for spinning up and using an EC2 instance running ws-clustr.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Python bindings for ws-clustr.php (optionally running it using an EC2 instance)

If you pass it a file containing points it will return a compressed shapefile
for those points created by the Clustr application.


Usage (from your code) :

# A backwards incompatible change the interface for this library
# was made on 20090420. If you are using an earlier version you
# should update your code accordingly. Sorry about that. The plan
# is to avoid doing that again in the future.

# Connecting to localhost

clustr = wsclustr.wsclustr(hostname='localhost')
shpfile = clustr.clustr('/path/to/points.txt', try_cache=1)

# Connecting to EC2

clustr = wsclustr.ec2(access_key='access_key', secret_key='secret_key')
while not clustr.ready() :

shpfile = clustr.clustr('/path/to/points.txt', try_cache=1)



Usage (connecting to EC2, from the command line) :

$> python examples/ -c ~/path/to/aws.cfg -A ami-xxxxx -P ~/path/to/points.txt -f ~/path/to/test.tar.gz -a 0.02 

  -h, --help            show this help message and exit
  -c CONFIG, --config=CONFIG
                        path to an ini config file
  -E ENDPOINT, --endpoint=ENDPOINT
                        the endpoint that ws-clustr is running on
  -A AMI, --ami=AMI     the name of the EC2 AMI to use
  -P POINTS, --points=POINTS
                        the path of the points file to clustrize
  -C, --try_cache       first ask ws-clustr to use a cached version of your points file
  -a ALPHA, --alpha=ALPHA
                        the size of the alpha to clustr the points file with
  -f FILENAME, --filename=FILENAME
                        the name of your shapefile
  -t, --terminate       terminate the AMI instance
  -v, --verbose         enable verbose logging


EC2 Notes:

If you already have a running instance of a given AMI then it will be used
rather than spinning up a new server.

At the moment, this code does not account for multiple instances of the same
AMI running. It simply uses the first one it finds.


Example config file: