https://github.com/schmavery/drizzle-postgis
A Drizzle extension/plugin to help work with PostGIS and GeoJSON
https://github.com/schmavery/drizzle-postgis
drizzle geojson postgis
Last synced: about 1 month ago
JSON representation
A Drizzle extension/plugin to help work with PostGIS and GeoJSON
- Host: GitHub
- URL: https://github.com/schmavery/drizzle-postgis
- Owner: Schmavery
- License: mit
- Created: 2024-03-29T15:11:37.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-07-10T01:04:21.000Z (10 months ago)
- Last Synced: 2025-03-17T22:37:20.537Z (about 1 month ago)
- Topics: drizzle, geojson, postgis
- Language: TypeScript
- Homepage: https://schmavery.github.io/drizzle-postgis/
- Size: 494 KB
- Stars: 14
- Watchers: 2
- Forks: 4
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
π drizzle-postgis
A Drizzle extension/plugin to help work with PostGIS and GeoJSON
Bug report
Β·
Feature request
Β·
Read Docs
## πΈ Disclaimer
I'm a GIS beginner, please let me know if you see anything problematic in the way this library is implemented.
The library is also missing support for very many functions. PRs are very welcome, all I ask is that you add test coverage for any new functions :)## π Installation
`pnpm add drizzle-postgis`
Patching drizzle-kit (See Troubleshooting for more info) is no longer required in most cases (unless you need to generate migrations with a box2d type).
## βTroubleshooting
If you're having trouble with Postgres complaining that the functions can't be found, try using `config.setPostGISSchema("")`
There's more information about how to use these functions here: https://postgis.net/docs/reference.html
### NOTE for people using box2d
> Unfortunately drizzle-kit has a bug that causes some custom types to be quoted. The only type in this library that is still affected (as of drizzle-kit 0.22.0) is `box2d`.
> In order to use this with migrations, you need to apply a patch (see below).
> This issue tracks this problem somewhat: https://github.com/drizzle-team/drizzle-kit-mirror/issues/350#### Step 1: Obtain the Patch File
The patch file is located in repository under the `patches` directory: `patches/[email protected]`. (Replace with your installed version of drizzle-kit).
You can copy the patch file content directly from the repository to your local patches directory.
#### Step 2: Apply the Patch
If you're using pnpm, you can apply the patch by adding the following lines to your `package.json` file under the `pnpm` section:
```json
"pnpm": {
"patchedDependencies": {
"drizzle-kit@": "patches/[email protected]"
}
}
```This configuration tells pnpm to apply the specified patch to the `drizzle-kit@` dependency.
Note that `patches/[email protected]` is the path to the patch fileAfter updating your `package.json`, run `pnpm install` to install the patched dependency.
#### Alternative: Manual Patching (not recommended)
If you prefer not to modify your `package.json`, you can manually apply the patch using the `patch` command:
1. Save the patch file content to a local file, e.g., `drizzle-kit.patch`.
2. Navigate to the directory where `drizzle-kit` is installed (usually `node_modules/drizzle-kit`).
3. Run the following command: `patch -p1 < /path/to/drizzle-kit.patch`This will apply the patch to the `drizzle-kit` dependency.
## π Auto generate docs
The project is configured to auto-generate the documentation using [typedoc](https://typedoc.org/). The documentation is generated in the `docs` folder.
The documentation will get generated when the code is pushed to the `main` branch. You can also generate the documentation locally by running the command `pnpm run build:docs`.
## π«±π»βπ«²πΌ Contributing
Please make sure to follow the [conventional commit messages](https://www.conventionalcommits.org/en/v1.0.0/) format while making changes. This helps in generating changelogs and versioning the package.
## π Thanks to
- π§ [@akashrajpurohit/ts-npm-template](https://akashrajpurohit.com/blog/building-and-publishing-typescript-npm-packages-a-stepbystep-guide/?ref=ts-npm-template-readme) - an opinionated bootstrap template to create NPM packages.
- β¨οΈ [Typescript](https://www.typescriptlang.org/) with [tsup](https://tsup.egoist.dev/) build tool.
- β‘οΈ [Vitest](https://vitest.dev/) - Unit Test Framework
- π [Semantic Release](https://semantic-release.gitbook.io/semantic-release/) - Fully automated version management and package publishing.
- π [Typedoc](https://typedoc.org/) - Generate documentation of your package.
- π [Github Actions](https://github.com/features/actions) - CI pipelines
- π¦ [PNPM](https://pnpm.io/) - Package manager