Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Andrew Mager mager

🏠
Working from home
Block or report user

Report or block mager

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:312
<?php echo 'Arquay is nice' ?>
View gist:404270
<?php
set_include_path(get_include_path() . PATH_SEPARATOR . '/home/amager/.pear/usr/local/php5/lib/pear/');
require_once 'Services_SimpleGeo/Services/SimpleGeo.php';
// your OAuth token and secret.
$client = new Services_SimpleGeo('367dYYDWfPvR2GBchKxAv4YpqWY7SvdP', 'XgqGtyRuajWyVKkTTGJqnqvjGRafhtpg');
var_dump($client->getRecord('com.simplegeo.test', '18'));
View simplegeo-gov.usgs.earthquake.parse-1.py
import simplegeo
import datetime
import time
from lxml import etree
from simplegeo import Client, Record, APIError
MY_OAUTH_KEY = 'my-oauth-key'
MY_OAUTH_SECRET = 'my-oauth-secret'
MY_LAYER = 'gov.usgs.earthquake'
View simplegeo-com.foursquare.mager.checkins.py
#!/usr/bin/python
import simplegeo
import time
import feedparser
from simplegeo import Client, Record, APIError
MY_OAUTH_KEY = '[insert_your_oauth_key_here]'
MY_OAUTH_SECRET = '[insert_your_oauth_secret_here]'
View simplegeo-com-csv-import.py
import csv
import simplegeo
OAUTH_TOKEN = '[insert_oauth_token_here]'
OAUTH_SECRET = '[insert_oauth_secret_here]'
CSV_FILE = '[insert_csv_file_here]'
LAYER = '[insert_layer_name_here]'
client = simplegeo.Client(OAUTH_TOKEN, OAUTH_SECRET)
View simplegeo_com-business-listing.json
{ "created" : 1271993072,
"distance" : 185.12556955794582,
"geometry" : { "coordinates" : [ -105.27319199999999,
40.019390999999999
],
"type" : "Point"
},
"id" : "141254950",
"layerLink" : { "href" : "http://api.simplegeo.com/0.1/layer/com.simplegeo.us.business.json" },
"properties" : { "area_code" : "303",
View simplegeo_com-business-listing-address.json
{housenumber} {pre_directional} {street_name} {street_type} {post_directional} {apt_type} {aptnumber}
{city} {state} {zip}-{plus4}
View simplegeo_com-tags-geojson.json
{
"type": "Feature",
"id": "test_record",
"created": 1278696668,
"geometry": {
"type": "Point",
"coordinates": [-105.27729, 40.016950]
},
"properties": {
"layer": "com.your.layer"
View simplegeo_com-tags-create-record.py
>>> record = simplegeo.Record("com.your.layer", "123", 40.016950, -105.27729,
tags=["restaurant", "featured"])
>>> client = simplegeo.Client(OAUTH_KEY, OAUTH_SECRET)
>>> client.add_record(record)
You can’t perform that action at this time.