示例#1
0
 def __init__(
     self,
     name,
     srid=4326,
     srid_out=4326,
     fid="gid",
     geometry="the_geom",
     order="",
     attribute_cols="*",
     writable=True,
     encoding="utf-8",
     hstore="false",
     hstore_attr="",
     **args
 ):
     DataSource.__init__(self, name, **args)
     self.table = args["layer"]
     self.fid_col = fid
     self.encoding = encoding
     self.geom_col = geometry
     self.order = order
     self.srid = srid
     self.srid_out = srid_out
     self.db = None
     self.dsn = args["dsn"]
     self.writable = writable
     self.attribute_cols = attribute_cols
     if hstore.lower() == "true":
         self.hstore = True
         self.hstoreAttribute = hstore_attr
     else:
         self.hstore = False
         self.hstoreAttribute = ""
示例#2
0
    def __init__(self, name, srid=4326, srid_out=4326, fid="gid", geometry="the_geom",
            order="", attribute_cols='*', writable=True, encoding="utf-8",
            geom_cls=None, geom_rel=None, join_condition=None, sql_echo=False,
            session=None, **args):
        DataSource.__init__(self, name, **args)
        self.dburi          = args["dburi"]
        self.sql_echo       = sql_echo
        self.session        = session
        self.model          = args["model"]
        self.cls            = args["cls"]
        self.fid_col        = fid
        self.geom_col       = geometry
        self.geom_rel       = geom_rel
        self.geom_cls       = geom_cls
        self.join_condition = join_condition
        self.order          = order
        self.srid           = srid
        self.srid_out       = srid_out
        self.writable       = writable
        self.encoding       = encoding
        self.attribute_cols = attribute_cols

        if not self.session:
            self.engine = create_engine(self.dburi, echo=self.sql_echo)
            self.session = sessionmaker(bind=self.engine)()
示例#3
0
    def __init__(self, name, srid = 4326, srid_out = 4326, fid = "gid", geometry = "the_geom", fe_attributes = 'true', order = "", attribute_cols = '*', writable = True, encoding = "utf-8", hstore = 'false', hstore_attr = "", **args):
        DataSource.__init__(self, name, **args)
        self.table          = args["layer"]
        self.fid_col        = fid
        self.encoding       = encoding
        self.geom_col       = geometry
        self.order          = order
        self.srid           = srid
        self.srid_out       = srid_out
        self.db             = None
        self.dsn            = args["dsn"]
        self.schema         = args.get('schema', "public")
        self.writable       = writable
        self.attribute_cols = attribute_cols
        
        self.fe_attributes = True
        if fe_attributes.lower() == 'false':
            self.fe_attributes  = False

        if hstore.lower() == 'true':
            self.hstore = True
            self.hstoreAttribute = hstore_attr
        else:
            self.hstore = False
            self.hstoreAttribute = "";
示例#4
0
 def __init__(self, name, api_key, api_secret, attributes = "*", srid_out = 4326, **args):
     DataSource.__init__(self, name, **args)
     self.api_key    = api_key
     self.api_secret = api_secret
     self.srid_out   = srid_out
     self.attributes = attributes
     
     self.api        = FlickrAPI(self.api_key, self.api_secret)
    def __init__(self, name, model = None, **args):
        DataSource.__init__(self, name, **args)
        self.model = model
        if self.model == None:
            self.model = FSModel

        self.excluded_fields = ['geometry','location']
        self.excluded_fields.extend(['location_geocell_' + str(x) for x in range(1,14)])
示例#6
0
 def __init__(self, name, writable = 0, lockfile = None, **args):
     DataSource.__init__(self, name, **args)
     self.db = Recno( args["file"] )
     self.append = self.db.append
     self.writable = int(writable)
     if self.writable and lockfile:
         self.lock = Lock(lockfile)
     else:
         self.lock = None
示例#7
0
 def __init__(self, name, srid = 4326, fid = "id", geometry = "shape", order = "", **args):
     DataSource.__init__(self, name, **args)
     self.db         = None
     self.table      = "feature" 
     self.fid_col    = fid
     self.geom_col   = geometry
     self.order      = order
     self.srid       = srid
     self.dsn        = args["dsn"]
示例#8
0
 def __init__(self, name, srid = 4326, fid = "ogc_fid", geometry = "wkb_geometry", order = "", writable = True, **args):
     DataSource.__init__(self, name, **args)
     self.table      = args["layer"]
     self.fid_col    = fid
     self.geom_col   = geometry
     self.order      = order
     self.srid       = srid
     self.db         = None
     self.dsn        = args["dsn"]
     self.writable   = writable
示例#9
0
 def __init__(self, name, srid=4326, order=None, writable=True, **args):
     DataSource.__init__(self, name, **args)
     self.table = args["layer"]
     self.fid_col = "feature_id"
     self.geom_col = "wkt_geometry"
     self.order = order
     self.srid = srid  # not used now...
     self.db = None
     self.dsn = args["dsn"]
     self.writable = writable
示例#10
0
 def __init__(self, name, api_key = None, secret = None, maxpages = 1, maxfeatures = 100, **args):
     DataSource.__init__(self, name, **args)
     global FLICKR_API_KEY, FLICKR_SECRET
     self.attributes = ['user_id','tags','tag_mode','text','min_upload_date','max_upload_date','min_taken_date','max_taken_date','license','sort','privacy_filter','accuracy','machine_tags','machine_tag_mode','group_id','per_page']
     self.queryable   = ','.join(self.attributes)
     self.api_key     = api_key or FLICKR_API_KEY
     self.secret      = secret  or FLICKR_SECRET
     self.maxpages    = maxpages
     self.maxfeatures = maxfeatures
     self.api         = API(self.api_key, self.secret)
示例#11
0
 def __init__(self, name, srid = 4326, order=None, writable = True, **args):
     DataSource.__init__(self, name, **args)
     self.table      = args.get("layer") or name
     self.fid_col    = 'feature_id'
     self.geom_col   = 'wkt_geometry'
     self.order      = order
     self.srid       = srid # not used now...
     self.db         = None
     self.dsn        = args.get("dsn") or args.get("file")
     self.writable   = writable
示例#12
0
    def __init__(self, name, consumer_key, consumer_secret, token_key, token_secret, srid_out = 4326, attributes="*", encoding = "utf-8", **args):
        DataSource.__init__(self, name, **args)
        self.consumer_key       = consumer_key
        self.consumer_secret    = consumer_secret
        self.token_key          = token_key
        self.token_secret       = token_secret
        self.srid_out           = srid_out
        self.encoding           = encoding
        self.attributes         = attributes

        self.api = TwitterAPI(self.consumer_key, self.consumer_secret, self.token_key, self.token_secret)
示例#13
0
 def __init__(self, name, srid = 4326, fid = "gid", geometry = "the_geom", order = "", attribute_cols = '*', writable = True, encoding = "utf-8", **args):
     DataSource.__init__(self, name, **args)
     self.table          = args["layer"]
     self.fid_col        = fid
     self.encoding       = encoding
     self.geom_col       = geometry
     self.order          = order
     self.srid           = srid
     self.db             = None
     self.dsn            = args["dsn"]
     self.writable       = writable
     self.attribute_cols = attribute_cols
示例#14
0
 def __init__(self, name, writable = 0, lockfile = 0, 
                          dsn = None, layer = None, **args):
     DataSource.__init__(self, name, **args)
     if int(writable) and lockfile: 
         self.lock = Lock(lockfile)
     else:
         self.lock = None
     self.ds     = ogr.Open( dsn, int(writable) )
     if layer:
         self.layer  = self.ds.GetLayerByName(layer)
     else:
         self.layer  = self.ds.GetLayer(0)
     self.defn   = self.layer.GetLayerDefn()
     self.fields = [self.defn.GetFieldDefn(i)
                     for i in range(self.defn.GetFieldCount())]
    def __init__(self, name, file, fid = "gid", geometry = "geometry", fe_attributes = 'true', order = "", srid = 4326, srid_out = 4326, encoding = "utf-8", writable = True, attribute_cols = "*", **kwargs):
        DataSource.__init__(self, name, **kwargs)
        self.file           = file
        self.table          = kwargs["layer"]
        self.fid_col        = fid
        self.geom_col       = geometry
        self.srid           = srid
        self.srid_out       = srid_out
        self.writable       = writable
        self.attribute_cols = attribute_cols
        self.order          = order
        self.encoding       = encoding

        self.fe_attributes = True
        if fe_attributes.lower() == 'false':
            self.fe_attributes  = False
示例#16
0
 def __init__(self, name, writable=0, lockfile=0, dsn=None, layer=None, attribute_cols="", **args):
     DataSource.__init__(self, name, **args)
     if int(writable) and lockfile:
         self.lock = Lock(lockfile)
     else:
         self.lock = None
     self.ds = ogr.Open(dsn, int(writable))
     if layer:
         self.layer = self.ds.GetLayerByName(layer)
     else:
         self.layer = self.ds.GetLayer(0)
     self.defn = self.layer.GetLayerDefn()
     self.fields = [self.defn.GetFieldDefn(i) for i in range(self.defn.GetFieldCount())]
     if attribute_cols:
         self.attribute_cols = [x.lower() for x in attribute_cols.split(",")]
     else:
         self.attribute_cols = None
示例#17
0
 def __init__(self, name, username, **args):
     DataSource.__init__(self, name, **args)
     self.username = username
示例#18
0
 def __init__(self, name, osmxapi="false", uninteresting_tags="attribution,created_by", **args):
     DataSource.__init__(self, name, **args)
     self.uninteresting_tags = uninteresting_tags.split(",")
     self.osmxapi = osmxapi.lower() in ("true", "1", "yes")
示例#19
0
 def __init__(self, name, url = None, typename = None,
                          version = "1.1.0", **args):
     DataSource.__init__(self, name, **args)
     self.url = url
     self.typename = typename
     self.version = version
示例#20
0
 def __init__(self, name, model=None, **args):
     DataSource.__init__(self, name, **args)
     self.model = model
     if self.model == None:
         self.model = FSModel