Repository navigation
MemoryGeoPackage #151
|
I want to create an in-memory GeoPackage database, but I can't work out what the syntax is. I see that there is a 'MemoryGeoPackage' Class. Which I think should look something like this: from fudgeo.geopkg import FeatureClass, Field, GeoPackage, SpatialReferenceSystem, MemoryGeoPackage
gpkg: GeoPackage = MemoryGeoPackage.create(geopath, flavor='EPSG')
conn = sqlite3.connect(":memory:")
# etc...Please could you provide a short snippet? |
Answered by
jlhumber
Mar 11, 2026
Replies: 1 comment
|
Hi @Didymograptus, good question, here's a snippet that should help: from fudgeo import MemoryGeoPackage, GeoPackage
from fudgeo.enumeration import GPKGFlavors
# open an existing geopackage
gpkg = GeoPackage('../data/example.gpkg')
input_fc = gpkg['detail_l']
# create a new memory geopackage, the path argument is completely ignored
mem_epsg = MemoryGeoPackage.create(flavor=GPKGFlavors.epsg)
# a second memory geopackage, each memory geopackage is isolated / independent of one another
mem_esri = MemoryGeoPackage.create(flavor=GPKGFlavors.esri)
fc = input_fc.copy(name='copied_detail_l', geopackage=mem_esri, where_clause='FID <= 500')
assert fc.exists
# use the connection property of the geopackage to get the connection object
conn = mem_epsg.connectionNote that doing this Let us know if you need more details. |
0 replies
Answer selected by
jlhumber
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @Didymograptus, good question, here's a snippet that should help: