Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions doc/api/workspace/flatgeobuf.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.. module:: workspace.flatgeobuf
:synopsis: Flatgeobuf workspace implementation.

Geobuf
======

.. automodule:: geoscript.workspace.flatgeobuf
:members: Flatgeobuf


10 changes: 10 additions & 0 deletions doc/api/workspace/geobuf.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.. module:: workspace.geobuf
:synopsis: Geobuf workspace implementation.

Geobuf
======

.. automodule:: geoscript.workspace.geobuf
:members: Geobuf


2 changes: 1 addition & 1 deletion geoscript/workspace/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ def _import(mod, clas):
Oracle = _import('oracle', 'Oracle')
GeoPackage = _import('geopackage', 'GeoPackage')
Geobuf = _import('geobuf', 'Geobuf')

FlatGeobuf = _import('flatgeobuf', 'FlatGeobuf')
24 changes: 24 additions & 0 deletions geoscript/workspace/flatgeobuf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"""
the :mod:`workspace.property` module provides a workspace implemntation based on a directory of java style property files.
"""

import os
from java import io, net
from geoscript import util
from geoscript.workspace import Workspace
from org.geotools.data.flatgeobuf import FlatgeobufDataStoreFactory

class FlatGeobuf(Workspace):
"""
A subclass of :class:`Workspace <geoscript.workspace.workspace.Workspace>` that provides layers that correspond to flatgeobuf files in a directory.

*dir* is the optional path as a ``str`` to a directory. If not specified it defaults to ``os.getcwd()``.
"""

def __init__(self, dir=None):
dir = dir or os.getcwd()
params = {'flatgeobuf-file': util.toFile(dir)}
Workspace.__init__(self, FlatgeobufDataStoreFactory(), params)

def __repr__(self):
return 'FlatGeobuf[%s]' % str(self._store.info.source.path)
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,11 @@
<artifactId>gt-imageio-ext-gdal</artifactId>
<version>${gt.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-flatgeobuf</artifactId>
<version>${gt.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-geopkg</artifactId>
Expand Down
13 changes: 13 additions & 0 deletions tests/workspace/test_flatgeobuf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import os
import shutil
from tests.workspace.workspacetest import WorkspaceTest
from geoscript.workspace import FlatGeobuf

class FlatGeobufWorkspace_Test(WorkspaceTest):

def setUp(self):
self.path = 'work/flatgeobufs'
if os.path.isdir(self.path):
shutil.rmtree(self.path)
os.mkdir(self.path)
self.ws = FlatGeobuf(self.path)