The create_db_model.py script is designed to create and update an ArcGIS geodatabase data model based on a JSON input file. This allows for easy modification and extension of the data model using additional JSON files at a later time.
Creating a data model using a JSON file has several advantages over manual creation in ArcGIS Pro. Here are some of them:
- Time-saving: Creating a data model using a JSON file is faster than manual creation in ArcGIS Pro because you can create the entire model in one go, rather than having to create each component one by one.
- Reusability: Once you have created a data model using a JSON file, you can reuse it multiple times, simply by modifying the file rather than recreating the model from scratch.
- Flexibility: JSON is a flexible format that allows you to easily add, remove, or modify components of the data model as needed.
- Traceability: By documenting changes to the data model in JSON files, you can easily track the evolution of the model over time and understand the reasoning behind each change.
- Collaboration: JSON files can be easily shared and edited by multiple people, making it easier to collaborate on the creation and modification of the data model.
To get started with creating an ArcGIS data model using JSON, you'll need the following:
- ArcGIS Pro installed on your machine
- The create_db_model.py script
- A JSON file describing the data model → example json files can be found in the tutorial folder
- A target geodatabase in which the data model is to be created: A file geodatabase (.gdb) or an enterprise geodatabase such as SQL Server (.sde), Oracle, or PostgreSQL.
To create or update an ArcGIS data model based on a JSON input file, run the "create_db_model.py" script with the path to the JSON file as a command-line argument:
python create_db_model.py data_model.json
Example json files and instruction README files can be found in the folder tutorial.
In tutorial 1 - Location with assets, a basic data model is created for managing locations with related asstes.
The focus is on the following elements:
- General settings
- Environment settings
- Coded value domain
- Range domain
- Feature Dataset
- Feature class
- Attribute rule (uniquie value constraint)
- Relationship "One to Many" (1:n)
- Update feature class
- Add field
- Calculate field
In tutorial 2 - Location Management, a data model is created for managing restaurants, shops and event places with related areas.
In this tuorial, the focus is on the following elements:
- Domain depending on subtypes
- Relationship depending on subtypes
In tutorial 3 - Event Management, a data model is created for managing event locations and the related events. An event location can have multiple events and an event can take place at multiple event locations.
In this tutorial, the focus is on the following elements:
- Relationship "Many to Many" (n:m) with attributed fields
In tutorial 4 - Relationship editing with attribute rules, a data model is created with complex attribute rules.
The focus is on the following elements:
- Attribute rule that contains multiple feature classes
- Attribute rules to edit related feature classes
In tutorial 5 - Estimation of road construction costs, a data model is created to estimate road construction costs depending on the road material.
The focus is on the following element:
- Attribute rules depending on subtypes
The JSON schema and the set of JSON parameters that can be used are described in the README file PARAMETERS.md.
A collection of data models can be found in the folder datamodels.
You are welcome to place your own data models here so that they can be used by the community.
Contributions to this project are welcome! If you have any suggestions or bug reports, please open an issue or pull request on GitHub.
This project is licensed under the terms of the MIT license. See the LICENSE file for more information.
This project includes the arcpy package from Esri (Copyright © 1995-2022 Esri), which is subject to its own license terms. Please refer to the Esri license agreement for more information.