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

Json Serializable #140

Open
cermakondrej opened this issue Mar 25, 2016 · 3 comments
Open

Json Serializable #140

cermakondrej opened this issue Mar 25, 2016 · 3 comments

Comments

@cermakondrej
Copy link

Is there some way to implement JSON Serializable interface to Point, Linestring etc. ? So it can be viewed by json_encode? I dont want to modify the vendor files directly, and i can't redeclare/override
CrEOF\Spatial\PHP\Types\Geometry/Point(Linestring, etc) ...

@ddproxy
Copy link
Member

ddproxy commented Mar 25, 2016

We've updated recently to allow geometries to be converted to json (geojson) via a ->toJson() method. We haven't impemented the JSON Serializable interface yet but it's in the roadmap for the next major update to the library.

@cermakondrej
Copy link
Author

But that's a method in the specific class, but if i have entity , that includes point, linestring etc, I would have to query to actualy get the point instance and then call toJson() instead of serializing whole entity or array of entities. The reason i want to implement json Serializable is the speed. I tried to use some JSON Serializing bundles, but serializing 3000 objects with those bundles to json takes aprox 8 seconds. With JSON Serializable it takes like 2-3 seconds ...

@bucefal91
Copy link

I have filed a pull request - #194

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants