Ejemplo n.º 1
0
  def __init__(self, db, dir=None):

    if dir:
      db = os.path.join(dir, db)

    params = {'database': db, 'dbtype': 'h2'}
    Workspace.__init__(self, H2DataStoreFactory(), params)
Ejemplo n.º 2
0
  def __init__(self, db, host='localhost', port=1025, user=None, passwd=None):

    user = user if user else db
    params = {'host': host, 'port': port, 'database': db, 'user':user, 
              'passwd': passwd, 'estimatedBounds': True, 'dbtype': 'teradata'} 
    
    Workspace.__init__(self, TeradataDataStoreFactory(), params)
Ejemplo n.º 3
0
  def __init__(self, db, host='localhost', port=5432, schema='public', 
               user=os.environ['USER'], passwd=None):

    params = {'host': host, 'port': port, 'schema': schema, 'database': db,
              'user':user, 'passwd': passwd, 'dbtype': 'postgis'}
    
    Workspace.__init__(self, PostgisNGDataStoreFactory(), params)
Ejemplo n.º 4
0
    def __init__(
        self,
        db,
        host="localhost",
        port=1433,
        schema=None,
        user=sysprop("user.name"),
        passwd=None,
        expose_pk=False,
        native_serialization=False,
    ):

        if schema is None:
            schema = user

        params = {
            "host": host,
            "port": port,
            "schema": schema,
            "database": db,
            "user": user,
            "passwd": passwd,
            "Expose primary keys": expose_pk,
            "dbtype": "sqlserver",
            "NATIVE_SERIALIZATION": native_serialization,
        }

        Workspace.__init__(self, SQLServerDataStoreFactory(), params)
Ejemplo n.º 5
0
  def __init__(self, db, host='localhost', port=5432, schema='public', 
               user=sysprop('user.name'), passwd=None, estimated_extent=False):

    params = {'host': host, 'port': port, 'schema': schema, 'database': db,
              'user':user, 'passwd': passwd, 'dbtype': 'postgis', 
              'Estimated extends': estimated_extent}
    
    Workspace.__init__(self, PostgisNGDataStoreFactory(), params)
Ejemplo n.º 6
0
    def __init__(self, db, user=None, passwd=None):

        params = {
            'database': db,
            'user': user,
            'passwd': passwd,
            'dbtype': 'geopkg'
        }

        Workspace.__init__(self, GeoPkgDataStoreFactory(), params)
Ejemplo n.º 7
0
  def __init__(self, db, host='localhost', port=1521, schema=None,
               user=sysprop('user.name'), passwd=None, estimated_extent=False):

    if schema is None:
      schema = user

    params = {'host': host, 'port': port, 'schema': schema, 'database': db,
              'user':user, 'passwd': passwd, 'dbtype': 'oracle', 
              'Estimated extends': estimated_extent}
    
    Workspace.__init__(self, OracleNGDataStoreFactory(), params)
Ejemplo n.º 8
0
    def __init__(self,
                 db,
                 host='localhost',
                 port=1025,
                 user=None,
                 passwd=None):

        user = user if user else db
        params = {
            'host': host,
            'port': port,
            'database': db,
            'user': user,
            'passwd': passwd,
            'estimatedBounds': True,
            'dbtype': 'teradata'
        }

        Workspace.__init__(self, TeradataDataStoreFactory(), params)
Ejemplo n.º 9
0
    def __init__(self,
                 db,
                 host='localhost',
                 port=5432,
                 schema='public',
                 user=os.environ['USER'],
                 passwd=None):

        params = {
            'host': host,
            'port': port,
            'schema': schema,
            'database': db,
            'user': user,
            'passwd': passwd,
            'dbtype': 'postgis'
        }

        Workspace.__init__(self, PostgisNGDataStoreFactory(), params)
Ejemplo n.º 10
0
def readJSON(json):
    """
  Reads a :class:`Layer <geoscript.layer.layer.Layer>` from GML. 

  *input* is the GML to read specified as a str, file, or some other input 
  stream.

  *ver* specifies the gml version to encode. Supported versions include 2, 3, 

  >>> json = '{"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"Point","coordinates":[1,2]},"properties":{},"id":"fid"}]}'
  >>> l = readJSON(json)
  >>> l.count()
  1
  """
    fcol = doInput(lambda input: _fjson.readFeatureCollection(input), json)

    from geoscript.workspace import Workspace
    ws = Workspace()
    ws._store.addFeatures(fcol)

    return [ws[name] for name in ws.layers()][0]
Ejemplo n.º 11
0
def readJSON(json):
  """
  Reads a :class:`Layer <geoscript.layer.layer.Layer>` from GML. 

  *input* is the GML to read specified as a str, file, or some other input 
  stream.

  *ver* specifies the gml version to encode. Supported versions include 2, 3, 

  >>> json = '{"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"Point","coordinates":[1,2]},"properties":{},"id":"fid"}]}'
  >>> l = readJSON(json)
  >>> l.count()
  1
  """
  fcol = doInput(lambda input: _fjson.readFeatureCollection(input), json)

  from geoscript.workspace import Workspace
  ws = Workspace()
  ws._store.addFeatures(fcol)

  return [ws[name] for name in ws.layers()][0]
Ejemplo n.º 12
0
def readGML(input, ver=2):
    """
  Reads a :class:`Layer <geoscript.layer.layer.Layer>` from GML. 

  *input* is the GML to read specified as a str, file, or some other input 
  stream.

  *ver* specifies the gml version to encode. Supported versions include 2, 3, 

  >>> xml = '<wfs:FeatureCollection xmlns:gml="http://www.opengis.net/gml" xmlns:wfs="http://www.opengis.net/wfs" xmlns:gsf="http://geoscript.org/feature"><gml:featureMember><gsf:layer_0 fid="fid"><gsf:geom><gml:Point><gml:coord><gml:X>1.0</gml:X><gml:Y>2.0</gml:Y></gml:coord></gml:Point></gsf:geom></gsf:layer_0></gml:featureMember></wfs:FeatureCollection>'
  >>> l = readGML(xml)
  >>> l.count()
  1
  """
    fc = xml.wfs.parse(input, ver)

    from geoscript.workspace import Workspace
    ws = Workspace()
    for f in fc.feature:
        ws._store.addFeatures(f)

    layers = [ws[name] for name in ws.layers()]
    return layers if len(layers) > 1 else layers[0]
Ejemplo n.º 13
0
def readGML(input, ver=2):
  """
  Reads a :class:`Layer <geoscript.layer.layer.Layer>` from GML. 

  *input* is the GML to read specified as a str, file, or some other input 
  stream.

  *ver* specifies the gml version to encode. Supported versions include 2, 3, 

  >>> xml = '<wfs:FeatureCollection xmlns:gml="http://www.opengis.net/gml" xmlns:wfs="http://www.opengis.net/wfs" xmlns:gsf="http://geoscript.org/feature"><gml:featureMember><gsf:layer_0 fid="fid"><gsf:geom><gml:Point><gml:coord><gml:X>1.0</gml:X><gml:Y>2.0</gml:Y></gml:coord></gml:Point></gsf:geom></gsf:layer_0></gml:featureMember></wfs:FeatureCollection>'
  >>> l = readGML(xml)
  >>> l.count()
  1
  """
  fc = xml.wfs.parse(input, ver)

  from geoscript.workspace import Workspace
  ws = Workspace()
  for f in fc.feature: 
    ws._store.addFeatures(f)

  layers = [ws[name] for name in ws.layers()]
  return layers if len(layers) > 1 else layers[0]
Ejemplo n.º 14
0
    def __init__(self):

        Workspace.__init__(self, MemoryDataStoreFactory())
Ejemplo n.º 15
0
    def __init__(self, db, host="localhost", port=3306, user=sysprop("user.name"), passwd=None):

        params = {"host": host, "port": port, "database": db, "user": user, "passwd": passwd, "dbtype": "mysql"}
        Workspace.__init__(self, MySQLDataStoreFactory(), params)
Ejemplo n.º 16
0
  def __init__(self):

    Workspace.__init__(self, MemoryDataStoreFactory())
Ejemplo n.º 17
0
 def __init__(self, dir=None):
     dir = dir or os.getcwd()
     params = {'directory': util.toFile(dir)}
     Workspace.__init__(self, PropertyDataStoreFactory(), params)
Ejemplo n.º 18
0
  def __init__(self, db, host='localhost', port=3306, user=sysprop('user.name'),
               passwd=None):

    params = {'host': host, 'port': port, 'database': db,
              'user':user, 'passwd': passwd, 'dbtype': 'mysql'}
    Workspace.__init__(self, MySQLDataStoreFactory(), params)
Ejemplo n.º 19
0
 def __init__(self, dir=None):
     dir = dir or os.getcwd()
     params = {'url': util.toURL(dir)}
     Workspace.__init__(self, ShapefileDataStoreFactory(), params)
Ejemplo n.º 20
0
  def __init__(self, db, host='localhost', port=3306, user=os.environ['USER'], 
               passwd=None):

    params = {'host': host, 'port': port, 'database': db,
              'user':user, 'passwd': passwd, 'dbtype': 'mysql'}
    Workspace.__init__(self, MySQLDataStoreFactory(), params)
Ejemplo n.º 21
0
 def data(self):
     return Workspace(ds=self._info.getDataStore(None))
Ejemplo n.º 22
0
 def __init__(self, dir=None):
   dir = dir or os.getcwd()
   params = {'url': util.toURL(dir)}
   Workspace.__init__(self, ShapefileDataStoreFactory(), params)
Ejemplo n.º 23
0
  def __init__(self, db, user=None, passwd=None):

    params = {'database': db, 'user':user, 'passwd': passwd, 'dbtype': 'geopkg'}
    
    Workspace.__init__(self, GeoPkgDataStoreFactory(), params)
Ejemplo n.º 24
0
 def __init__(self, dir=None):
   dir = dir or os.getcwd()
   params = {'directory': util.toFile(dir)}
   Workspace.__init__(self, PropertyDataStoreFactory(), params)