cakephp / cakephp/phinx

Geometry is converted to Geography

Open
#1,506 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

feature
Dominant language
PHP
Stars
4.5k
Forks
884
PR merge metrics
No merged PRs in 30d

Description

Hi.

I would like to use geometry type in Postgresql.
However geometry seems to be replaced by geography.

https://github.com/cakephp/phinx/blob/a15a5ffdb2f0b1d391891d44de831d1caf96d53a/src/Phinx/Db/Adapter/PostgresAdapter.php#L951-L962

I want to use ST_CONTAINS(geometry, geometry)
But it can not be used in Geography

I do not want to cast because I want to process a large amount of data

Is there a function that deserves st_contains that can be used with geography type or how to create a table with geometry?

thanks.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/Phinx/Db/Adapter/PostgresAdapter.php around lines 951-962 and trace how PostgreSQL spatial types are mapped during table creation. Reproduce the reported geometry-to-geography conversion with ST_CONTAINS; done means a migration can create a geometry column without requiring a cast.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, postgresql
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.