Files
Spring Operator e0ef48eb78 #474 - URL Cleanup.
This commit updates URLs to prefer the https protocol. Redirects are not followed to avoid accidentally expanding intentionally shortened URLs (i.e. if using a URL shortener).

# Fixed URLs

## Fixed Success
These URLs were switched to an https URL with a 2xx status. While the status was successful, your review is still recommended.

* [ ] http://www.apache.org/licenses/ with 1 occurrences migrated to:
  https://www.apache.org/licenses/ ([https](https://www.apache.org/licenses/) result 200).
* [ ] http://www.apache.org/licenses/LICENSE-2.0 with 320 occurrences migrated to:
  https://www.apache.org/licenses/LICENSE-2.0 ([https](https://www.apache.org/licenses/LICENSE-2.0) result 200).
2019-03-22 08:00:34 +01:00
..
2019-03-22 08:00:34 +01:00
2019-03-20 10:11:16 -05:00
2015-03-10 14:07:05 +01:00

Spring Data MongoDB - GeoJSON examples

This project contains samples of GeoJSON specific features of Spring Data (MongoDB).

Support for GeoJSON types in domain classes

Using GeoJSON types in domain classes is straight forward. The org.springframework.data.mongodb.core.geo package contains types like GeoJsonPoint or GeoJsonPolygon which are extensions to the existing org.springframework.data.geo types. Find more information in the MongoDB manual on GeoJSON support to learn about requirements and restrictions.

public class Store {

	String id;

	/**
	 * location is stored in GeoJSON format.
	 * {
	 *   "type" : "Point",
	 *   "coordinates" : [ x, y ]
	 * }
	 */
	GeoJsonPoint location;
}

Support for GeoJSON types in repository methods

Using GeoJson types as repository query parameters forces usage of the $geometry operator when creating the query.

public interface StoreRepository extends CrudRepository<Store, String> {

	List<Store> findByLocationWithin(Polygon polygon);
}
/* {
 *   "location": {
 *     "$geoWithin": {
 *       "$geometry": {
 *         "type": "Polygon",
 *         "coordinates": [
 *           [
 *             [-73.992514,40.758934],
 *             [-73.961138,40.760348],
 *             [-73.991658,40.730006],
 *             [-73.992514,40.758934]
 *           ]
 *         ]
 *       }
 *     }
 *   }
 * }
 */
repo.findByLocationWithin(
  new GeoJsonPolygon(
    new Point(-73.992514, 40.758934),
    new Point(-73.961138, 40.760348),
    new Point(-73.991658, 40.730006),
    new Point(-73.992514, 40.758934)));

/* {
 *   "location" : {
 *     "$geoWithin" : {
 *        "$polygon" : [ [ -73.992514, 40.758934 ] , [ -73.961138, 40.760348 ] , [ -73.991658, 40.730006 ] ]
 *     }
 *   }
 * }
 */
repo.findByLocationWithin(
  new Polygon(
    new Point(-73.992514, 40.758934),
    new Point(-73.961138, 40.760348),
    new Point(-73.991658, 40.730006));