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 xlrd | |
import time | |
from simplegeo import Client, json, APIError | |
#from multiprocessing.pool import ThreadPool as Pool | |
from multiprocessing import Pool | |
def f(z): | |
z = str(z) | |
neighborhoods = [] | |
error = "" |
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 xlrd | |
from simplegeo import Client, json, APIError | |
#from multiprocessing.pool import ThreadPool as Pool | |
from multiprocessing import Pool | |
def f(z): | |
z = str(z) | |
neighborhoods = [] | |
error = "" | |
try: |
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 xlrd | |
from simplegeo import Client, json, APIError | |
from multiprocessing import Pool | |
def f(z): | |
z = str(z) | |
try: |
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
// delete a place | |
[client deletePlace:@"SG_placeID" | |
callback:[SGCallback callbackWithSuccessBlock: | |
^(id response) { | |
// deletion confirmed | |
} failureBlock:^(NSError *error) { | |
// deletion failed | |
}]]; |
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
// update a place | |
[client updatePlace:@"SG_placeID" | |
withPlace:newPlace | |
callback:[SGCallback callbackWithSuccessBlock: | |
^(id response) { | |
// update confirmed | |
} failureBlock:^(NSError *error) { | |
// update failed | |
}]]; |
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
// add a place | |
SGPlace *place = [SGPlace placeWithName:@"SimpleGeo Headquarters" | |
point:[SGPoint pointWithLat:37.772445 lon:-122.405913]]; | |
[place setClassifiers:***arrayOfClassifierDictionaries***] // optional | |
[place setProperties:***propertiesDictionary***] // optional | |
[place setTags:***arrayOfTags***]; // optional | |
[client addPlace:place |
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
// find the three nearest Italian restaurants within five kilometers of an address | |
SGPlacesQuery *query = [SGPlacesQuery queryWithAddress:@"41 Decatur St, San Francisco, CA"]; | |
[query setCategories:[NSArray arrayWithObjects:SGPlacesCategoryRestaurant, SGPlacesCategoryFood, nil]]; | |
[query setSearchString:@"Italian"]; | |
[query setRadius:5.0]; | |
[query setLimit:3]; | |
[client getPlacesForQuery:query |
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
// find places near a point | |
SGPlacesQuery *query = [SGPlacesQuery queryWithPoint:[SGPoint pointWithLat:37.772445 lon:-122.405913]]; | |
[client getPlacesForQuery:query | |
callback:[SGCallback callbackWithSuccessBlock: | |
^(id response) { | |
// you've got Places! | |
// to create an array of SGPlace objects... | |
NSArray *places = [NSArray arrayWithSGCollection:response |
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
// get voting districts for an area | |
SGEnvelope *envelope = [SGEnvelope envelopeWithNorth:40.613952 | |
west:-105.90271 | |
south:39.078908 | |
east:-103.513184]; | |
[query setFilters:[NSArray arrayWithObject:SGContextFilterFeatures]]; | |
[query setFeatureCategories:[NSArray arrayWithObjects:SGFeatureCategoryLegislativeDistrict, | |
SGFeatureCategorySchoolDistrict, |
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
// get advanced demographic information for an address | |
SGContextQuery *query = [SGContextQuery queryWithAddress:@"41 Decatur Street, San Francisco, CA"]; | |
[query setFilters:[NSArray arrayWithObject:SGContextFilterDemographics]]; | |
[query setACSTableIDs:[NSArray arrayWithObjects:@"B05005", @"B06009", @"B07001", nil]]; | |
[client getContextForQuery:query | |
callback:[SGCallback callbackWithSuccessBlock: | |
^(id response) { | |
// you've got demographics! |