0

I am new to geospatial data analysis, and I would also use just free and open-source Python packages to work with.

Now I try to create geodatabase (.gdb), but I can not find any appropriate Python package to do so, however there is some Python package to read .gdb files such as GDAL and Fiona as explained in this question but I am not sure (and can not find) any appropriate way to create a geodatabase (from scratch) using these packages.

Now my main questions are

  1. Except ArcGIS (and ArcPy) is there any other package to create a geodatabase?
  2. If the answer to question one is "YES", how can I create a geodatabase in Python?
6
  • 4
    The GDAL driver is read/write gdal.org/drivers/vector/openfilegdb.html.
    – user30184
    Commented Apr 12 at 11:35
  • 1
    "File geodatabase" isn't a file, it's a directory with scores to thousands of files. Creating a file geodatabase is trivial, and just gets you an empty container.
    – Vince
    Commented Apr 12 at 11:51
  • You're right, geodatabase is a directory, I will also edit it in my question text. But my main question is about creating a geodatabase whose content is some CSV files, and raster files together with point and polygon shape files.
    – amin13afa
    Commented Apr 12 at 12:03
  • The raster access with GDAL is read-only gdal.org/drivers/raster/openfilegdb.html#raster-openfilegdb. Are you forced to use some special ESRI tools, or could you just forget filegeodatabase and use free and open format like GeoPackage instead?
    – user30184
    Commented Apr 12 at 12:23
  • I'm general you should encourage your end users to switch to an open format rather than continuing to force proprietary lock in.
    – Ian Turton
    Commented Apr 12 at 13:31

1 Answer 1

2

I dont know about raster support, but you can create a file geodatabase by writing any table to it:

import geopandas as gpd
df = gpd.GeoDataFrame(geometry=gpd.points_from_xy(x=[1], y=[1]), crs=4326)
df.to_file(filename=r"C:\GIS\GIStest\a_new_database.gdb", layer="temptable", driver="OpenFileGDB")

Then you'll have to delete the table created.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.