Skip to content

Instantly share code, notes, and snippets.

@zookos
Created December 22, 2010 17:45
Show Gist options
  • Save zookos/751820 to your computer and use it in GitHub Desktop.
Save zookos/751820 to your computer and use it in GitHub Desktop.
HACK Zooko-Ofsimplegeos-MacBook-Pro:~/playground/python-simplegeo-shared$ git diff
diff --git a/simplegeo/shared/__init__.py b/simplegeo/shared/__init__.py
index 7004958..a71412b 100644
--- a/simplegeo/shared/__init__.py
+++ b/simplegeo/shared/__init__.py
@@ -61,6 +61,8 @@ def is_valid_lat(x):
def is_valid_lon(x):
return is_numeric(x) and (x <= 180) and (x >= -180)
+DEFAULT_VALUE_OF_PRIVATE=# True or False goes here
+
class Feature:
def __init__(self, coordinates, geomtype='Point', simplegeohandle=None, properties=None):
"""
@@ -92,6 +94,18 @@ class Feature:
"Polygon", or "Multipolygon". coordinates is a GeoJSON
coordinates *except* that each lat/lon pair is written in
order lat, lon instead of the GeoJSON order of lon, at.
+
+ When a Feature is being submitted to the SimpleGeo Places
+ database, the key 'private' in the properties dict will
+ determine whether the Feature is intended to be merged into
+ the publicly visible Places Database or whether it is intended
+ to be visible only to your user account. Note that even if it
+ is intended to be merged the actual process of merging it into
+ the public shared database may take some time, and that the
+ newly added Feature will be visible to your account right away
+ even if it isn't (yet) visible to the public. If you don't
+ specify a 'private' key then it defaults to
+ $DEFAULT_VALUE_OF_PRIVATE.
"""
precondition(deep_validate_lat_lon(coordinates), "The first argument, 'coordinates' is required to be a 2-element sequence of lon, lat for a point (or a more complicated set of coordinates for polygons or multipolygons).", coordinates)
precondition(simplegeohandle is None or is_simplegeohandle(simplegeohandle), "The third argument, 'simplegeohandle' is required to be None or to match this regex %s" % SIMPLEGEOHANDLE_RSTR, simplegeohandle=simplegeohandle)
@@ -101,7 +115,7 @@ class Feature:
self.id = simplegeohandle
self.coordinates = coordinates
self.geomtype = geomtype
- self.properties = {}
+ self.properties = { 'private': DEFAULT_VALUE_OF_PRIVATE }
if properties:
self.properties.update(properties)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment