-
-
Notifications
You must be signed in to change notification settings - Fork 189
Conversation
1)
For the most shapes it's a simple copy of the old The same with the 2) The
Simply it does the same as the user can, but if the user forgets about the radius should be in radians, the |
I created a library two weeks ago, geojson, that I'm hoping will address this without the need to create duplicate methods. If the first argument is a Geometry object, we'd immediately know to use the GeoJSON operators under the hood. Additionally, the library does all the validation of shapes upon construction. I blogged about this last week here.
I think this is best left to the user. If the sphere happens to not be earth, the multiplier will differ anyway. Also, this would let Doctrine avoid having to default to accepting miles or kilometers. If the user did want to pass radians, and we defaulted to one of the other units, they'd have to specify a multiplier of |
@patkar: I resolved the outstanding todo items and pushed the changes I discussed in my last comment. Let me know what you think. I added deprecation doc tags to the older I want to be careful to leave the GeoJSON library as an optional dependency, so perhaps I can go a step further and remove the type-hints in
If a GeoJSON object is passed in, I can call |
87cb4b1 adds support for using basic arrays, removing the dependency on jmikola/geojson for |
This changes the polygon methods to accept an array of rings, which themselves are arrays of point tuples. Subsequent rings define holes in the first ring (i.e. outer polygon). In the future, it may be worthwhile to have a builder for polygons.
This adds an optional dependency to a GeoJSON library (see: composer.json) for handling 2dsphere queries in query builder and expression methods. It was necessary to discern between GeoJSON points and legacy coordinates for $near and $nearSphere operators, due to how they incorporate the $maxDistance option. Additionally, using an external library for GeoJSON geometries removes the responsibility of validating those geometries from doctrine/mongodb. Tests were updated and added for all geospatial methods in the builder and expression classes.
This relaxes the GeoJSON library dependency, so 2dsphere queries (namely $geoIntersects and $geoWithin) can still be done without it.
Support GeoJSON and 2dsphere queries
This PR:
Todo items:
$maxDistance
works with$near
2dsphere queries$centerSphere
with$geoWithin