Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Allow setting WKT options or disabling WKT options entirely.#152

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
Persaeus wants to merge3 commits intogrimzy:master
base:master
Choose a base branch
Loading
fromPersaeus:wkt-options

Conversation

Persaeus
Copy link

@PersaeusPersaeus commentedOct 2, 2020
edited
Loading

Unlike MySQL, the WKT-input spatial analysis functions inMariaDB likeST_GeomFromText andST_DISTANCE do not take an options parameter:https://mariadb.com/kb/en/st_geomfromtext/

If I understand correctly, we need to pass "axis-order=long-lat" because otherwise some versions of MySQL will interpret coordinate pairs as lat-long. For MariaDB, this is not necessary because MariaDB reads WKT values as long-lat by default.

In its current state, using this package with MariaDB will throw the following exception when trying to insert or update values for a spatial column, because we force the third options parameter inST_GeomFromText:

Syntax error or access violation: 1582 Incorrect parameter count in the call to native function 'ST_GeomFromText'

This is because the MariaDB function expects at most two arguments:https://github.com/MariaDB/server/blob/cf87f3e08c10dd7a944447ddee93fbc3827e6570/sql/item_geofunc.cc#L2993

This PR adds the option to set a$wktOptions property on the model that will overwrite the default options "axis-order=long-lat". It can be set to false to remove the options parameter entirely, which fixes the errors when using MariaDB.

Additionally, it adds flexibility for users that may want or need to change the WKT options for whichever reason.

This is completely backwards-compatible, because if$wktOptions is not set, it will default to "axis-order=long-lat".

madbob, polyskalov, askuri, and carestad reacted with thumbs up emoji
@Persaeus
Copy link
Author

Fixes#153

trippo and bernhardh reacted with thumbs up emoji

@madbob
Copy link

Testing now (MariaDB 15.1) and working as expected.
Thank you!

Persaeus and polyskalov reacted with hooray emoji

@polyskalov
Copy link

polyskalov commentedNov 14, 2020
edited
Loading

@grimzy, will this request be merged?

Install package and got this error with parameters count, don't know what to do

ccantet reacted with thumbs up emoji

@ccantet
Copy link

I'm waiting a merge of this pull request too

trippo reacted with thumbs up emoji

@Wulfheart
Copy link

This would be really helpful!

trippo reacted with eyes emoji

@carestad
Copy link

This would be nice indeed. Any plans of looking this over and perhaps merging@grimzy?

@vdomah
Copy link

same, merge is strongly needed

@a-hardin
Copy link

please add this

@bernhardh
Copy link

please add this :(

@Persaeus
Copy link
Author

No activity on the master branch since Oct 2020. Looks like@grimzy might have abandoned the project.

@Surzhikov
Copy link

My problem is related to two Issues at once (this one, about wktOptions with MariaDB, and another one, with Laravel 9.x Compatibility).

So the solution is to make it work with Laravel 9.x + MariaDB 10.x

  1. Add repohttps://github.com/Surzhikov/laravel-mysql-spatial to your composer.json:
    "repositories": [       {            "type": "vcs",            "url": "https://github.com/Surzhikov/laravel-mysql-spatial"       }    ],
  1. composer require grimzy/laravel-mysql-spatial:master

  2. In your model add$wktOptions = '' line, like this:

<?phpnamespace App\Models;use \Grimzy\LaravelMysqlSpatial\Eloquent\SpatialTrait;class MyModel extends Model{use SpatialTrait;protected $wktOptions = '';...

You can use this solution, while we hope that the@grimzy will have some time to build version for Laravel 9 with wktOptions ;)

Persaeus reacted with thumbs up emoji

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

10 participants
@Persaeus@madbob@polyskalov@ccantet@Wulfheart@carestad@vdomah@a-hardin@bernhardh@Surzhikov

[8]ページ先頭

©2009-2025 Movatter.jp