Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Pg] Add PostGIS MultiLineString support #2769

Open
wants to merge 8 commits into
base: beta
Choose a base branch
from

Conversation

mauriciabad
Copy link

@mauriciabad mauriciabad commented Aug 8, 2024

Adds support for MultiLineString from PostGIS.

Currently, the geometry type added in v0.31.0 only supports point, despite the documentation saying otherwise.

I did this PR because I need a MultiLineString in my project, but if you come up with a way to support any PostGIS type, it would be awesome, meanwhile, adding the type multilinesting may be enough.

The signature I defined is quite minimal and trivial, so if in the future you decide to internally implement PostGIS in a completely different way, it probably won't have breaking changes.

@@ -45,3 +45,64 @@ export function parseEWKB(hex: string): [number, number] {

throw new Error('Unsupported geometry type');
}

export function parseMultiLineStringEWKB(hex: string): [number, number][][] {
Copy link
Author

@mauriciabad mauriciabad Aug 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disclaimer: I did this function with AI, it may have mistakes. My PostgreSQL knowledge is not that deep to write it myself. 😅

@mauriciabad mauriciabad changed the title feat: Support MultiLineString postgis column type [Pg-kit] Add PostGIS MultiLineString column type support Aug 9, 2024
@mauriciabad mauriciabad changed the title [Pg-kit] Add PostGIS MultiLineString column type support [Pg] Add PostGIS MultiLineString column type support Aug 9, 2024
@mauriciabad mauriciabad changed the title [Pg] Add PostGIS MultiLineString column type support [Pg] Add PostGIS MultiLineString support Aug 9, 2024
@mauriciabad
Copy link
Author

I'm unable to run the tests. 😢

I'm following the guidelines (nvm use, open docker, pnpm i, pnpm build, cd integration-tests, pnpm test), but the mysql-planetscale.test.ts keeps failing. Due to Error: Can't add new command when connection is in closed state and TypeError: fetch failed. Caused by: Error: getaddrinfo ENOTFOUND undefined.

It is not breaking due to my PR, because I'm runing the tests in main the branch.

Could you (mantainers) run the tests in your computer, or help me run them?

@mauriciabad mauriciabad marked this pull request as ready for review August 9, 2024 00:57
@mauriciabad mauriciabad changed the base branch from main to beta August 9, 2024 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant