Comments (7)
I'm working on a PR for this task srid.
from laravel-mysql-spatial.
Thank you for reporting this.
I agree, we have to handle SRIDs when fetching and comparing spatial data.
As you mentioned, to fix this issue we should update how all fields types are represented in queries, for example:
ST_GeomFromText("POINT(0 -10)")
ST_GeomFromText("POLYGON((40 -10,-10 -10,-10 40,40 40,40 -10))")
become:
ST_GeomFromText("POINT(0 -10)", 4326)
ST_GeomFromText("POLYGON((40 -10,-10 -10,-10 40,40 40,40 -10))", 4326)
(or an SRID different than 4326, depending on what is stored)
I think this issue is also related to #47 (how the package fetches the binary data from the database).
And yes, PRs are greatly appreciated! And unit tests to fasten a release event more! π
from laravel-mysql-spatial.
So if I comprehended it well, there is currently no option how to save POINT object with SRID different than 0. Am I right? I was trying to find a way for a week without success. When I tried to use SRID = 0 all the spatial functions returned me really weird data so I assume it is caused by this. :(
from laravel-mysql-spatial.
@grimzy is there any update on adding support for SRID?
from laravel-mysql-spatial.
@sikhlana To be honest, no.
Currently we do this: https://github.com/grimzy/laravel-mysql-spatial/blob/master/src/Types/Geometry.php#L55:
public static function fromWKB($wkb)
{
// mysql adds 4 NUL bytes at the start of the binary
$wkb = substr($wkb, 4);
$parser = new Parser(new Factory());
return $parser->parse($wkb);
}
Literally: we remove the srid
info from the WKB, then parse it. This code is to make the parser "compatible" with MySQL's WKB (meh... it just uses the default: 4326).
In any case, I've tried other parsers, tried to decode myself; but no dice.
Any help is greatly appreciated!!! Last time I pushed something for this was in the srid branch. I think the rest of the commits in that branch have every other change needed.
from laravel-mysql-spatial.
@kotasjn sorry :(
from laravel-mysql-spatial.
@grimzy I'm checking if integrating with https://github.com/libgeos/php-geos does any trick. Will let you know.
from laravel-mysql-spatial.
Related Issues (20)
- This makes funny things to the DB, and then break stuffβ¦
- Syntax error with Laravel 8, MariaDB 10.6 and SRID HOT 2
- Migration from 4.X to 5.0.0 breaks SRID HOT 2
- Error in save or retrieve HOT 1
- Not able to update geometry field with MultiPoint HOT 1
- Does it work with PHP8.1 ? HOT 4
- Laravel 9 Support HOT 19
- MariaDB doesnt support creating a geometrycolumn with an SRID
- Polygon GeoJson String Validation
- laravel 9 HOT 2
- Invalid parameter value: 3037 Invalid GIS data provided to function st_geometryfromtext
- Cast request spatial data to Eloquent model via fill method is not possible
- Cast request spatial data to Eloquent model via fill method is not possible HOT 1
- Should support sqlite / spatiallite
- {"message":"Call to a member function getLat() on string"}
- Slow Cache retrieval
- Laravel 10 HOT 3
- Laravel 9 Issue HOT 3
- Any Update for Laravel 10 HOT 2
- Type error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-mysql-spatial.