realiii / pygeopkg Goto Github PK
View Code? Open in Web Editor NEWA Python library that allows for the creation and population of OGC GeoPackage databases with write access.
License: MIT License
A Python library that allows for the creation and population of OGC GeoPackage databases with write access.
License: MIT License
It looks like there's no Z space for polygons.
http://www.geopackage.org/spec131/#_sqlite_container
I can't see why it's left out of the standard types.
I've found this project to be extremely useful in several projects that I maintain for my organisation. At present I generally use pygeopkg in those projects by adding it as a Git submodule; however it seems like it would be relatively straightforward to package and publish it to Pypi (I note that the pygeopkg
namespace is unused).
Is this something that the maintainers would be interested in, or alternatively something that would be welcomed as a pull request? I'd be happy to do so, having packaged a couple of other simple projects in the past.
Currently, I am writing two OGC draft GeoPackage extension standards. One for Features and one for Tiles. Milestone for RFC is September 2022.
To generate GeoPackage instance files for compliance testing, I am looking for an easy to use library. Looking at this library, it looks promising for the Features extension. But, there is no Tiles support :-(
It would be great to see the Tiles support in the near future. Possible?
Best
Andreas
I've searched the main README for instructions on creating datetime fields, but unless there are other docs somewhere, I can't seem to find a solution for this. It seems that providing a SQLFieldTypes.datetime
as the type for a field causes an error:
from pygeopkg.core.geopkg import GeoPackage
from pygeopkg.core.srs import SRS
from pygeopkg.core.field import Field
from pygeopkg.shared.enumeration import GeometryType, SQLFieldTypes
import pathlib
gpkg = GeoPackage.create(pathlib.Path.home().joinpath("test_datetime.gpkg"))
srs_wkt = 'GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433],AUTHORITY["EPSG",4326]]'
srs = SRS("WGS84", "EPSG", 4326, srs_wkt)
fields = (
Field('int_fld', SQLFieldTypes.integer),
Field('date_fld', SQLFieldTypes.date),
Field('datetime_fld', SQLFieldTypes.datetime)
)
fc = gpkg.create_feature_class(
"test",
srs,
fields=fields,
shape_type=GeometryType.point
)
This throws the following error:
Traceback (most recent call last):
File "C:\temp\.venv\lib\site-packages\IPython\core\interactiveshell.py", line 3397, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-5-4e68b047d91e>", line 14, in <cell line: 14>
fc = gpkg.create_feature_class(
File "C:\temp\.venv\lib\site-packages\pygeopkg\core\geopkg.py", line 171, in create_feature_class
self._create_feature_table(name, shape_type, fields)
File "C:\temp\.venv\lib\site-packages\pygeopkg\core\geopkg.py", line 196, in _create_feature_table
connection_execute(self.full_path, sql)
File "C:\temp\.venv\lib\site-packages\pygeopkg\core\utils.py", line 30, in connection_execute
result = conn.execute(sql)
sqlite3.OperationalError: near "(": syntax error
Dropping that SQLFieldTypes.datetime
field, though, and everything works like a charm.
Am I just missing something like an argument for that datetime format?
Currently, the generated geopackage does not contain feature counts in the gpkg_ogr_contents table (https://gdal.org/drivers/vector/gpkg.html#dataset-creation-options).
This means that if we are writing to an existing geopackage generated with e.g. QGIS, the feature counts for layers will not be updated and QGIS will show old feature counts. Also, QGIS cannot correct this any more. Probably triggers that update feature counts in this table are also missing.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.