List of usage examples for org.springframework.data.geo Point Point
@PersistenceConstructor public Point(double x, double y)
From source file:com.frank.search.solr.core.query.GeoHashFunction.java
/** * @param latitude/* ww w. j a v a2 s . c o m*/ * @param longitude * @return */ public static GeoHashFunction geohash(double latitude, double longitude) { return geohash(new Point(latitude, longitude)); }
From source file:com.couchbase.trombi.domain.Location.java
public Location(String name, String desc, int timeZoneOffset, double x, double y) { this(name, desc, timeZoneOffset, new Point(x, y)); }
From source file:com.ninjas.movietime.core.domain.theater.GeoLocation.java
@JsonCreator public GeoLocation(@JsonProperty("lat") double latitude, @JsonProperty("long") double longitude) { this.latitude = latitude; this.longitude = longitude; this.point = new Point(longitude, latitude); }
From source file:org.springframework.data.geo.GeoModuleIntegrationTests.java
@Test // DATACMNS-475 public void deserializesPoint() throws Exception { String json = "{\"x\":10.0,\"y\":20.0}"; Point reference = new Point(10.0, 20.0); assertThat(mapper.readValue(json, Point.class)).isEqualTo(reference); assertThat(mapper.writeValueAsString(reference)).isEqualTo(json); }
From source file:com.ninjas.movietime.repository.TheaterRepositoryTest.java
@Test public void listByGeoLocation() { final GeoPage<Theater> theaters = theaterRepository.listByGeoLocation(new Point(48.88366, 2.3272), new PageRequest(0, 2)); assertThat(theaters.getContent(), not(empty())); assertThat(theaters.getContent().size(), is(2)); }
From source file:demo.ServiceLocation.java
@SuppressWarnings("unused") private ServiceLocation() { this.location = new Point(0, 0); }
From source file:example.springdata.rest.stores.StoreRepositoryIntegrationTests.java
@Test public void findsStoresByLocation() { Point location = new Point(-73.995146, 40.740337); Store store = new Store("Foo", new Address("street", "city", "zip", location)); store = repository.save(store);/* ww w . ja v a 2 s. co m*/ Page<Store> stores = repository.findByAddressLocationNear(location, new Distance(1.0, Metrics.KILOMETERS), new PageRequest(0, 10)); assertThat(stores.getContent(), hasSize(1)); assertThat(stores.getContent(), hasItem(store)); }
From source file:example.app.model.Address.java
public static Point newPoint(double x, double y) { return new Point(x, y); }
From source file:example.springdata.mongodb.fluent.ApplicationConfiguration.java
@Bean
CommandLineRunner init(MongoTemplate template) {
return (args) -> {
if (template.collectionExists(COLLECTION)) {
template.dropCollection(COLLECTION);
}//from w w w .j ava 2 s . c o m
GeospatialIndex index = new GeospatialIndex("homePlanet.coordinates") //
.typed(GeoSpatialIndexType.GEO_2DSPHERE) //
.named("planet-coordinate-idx");
template.createCollection(COLLECTION);
template.indexOps(SWCharacter.class).ensureIndex(index);
Planet alderaan = new Planet("alderaan", new Point(-73.9667, 40.78));
Planet stewjon = new Planet("stewjon", new Point(-73.9836, 40.7538));
Planet tatooine = new Planet("tatooine", new Point(-73.9928, 40.7193));
Jedi anakin = new Jedi("anakin", "skywalker");
anakin.setHomePlanet(tatooine);
Jedi luke = new Jedi("luke", "skywalker");
luke.setHomePlanet(tatooine);
Jedi leia = new Jedi("leia", "organa");
leia.setHomePlanet(alderaan);
Jedi obiWan = new Jedi("obi-wan", "kenobi");
obiWan.setHomePlanet(stewjon);
Human han = new Human("han", "solo");
template.save(anakin, COLLECTION);
template.save(luke, COLLECTION);
template.save(leia, COLLECTION);
template.save(obiWan, COLLECTION);
template.save(han, COLLECTION);
};
}
From source file:demo.ServiceLocation.java
@JsonCreator public ServiceLocation(@JsonProperty("latitude") double latitude, @JsonProperty("longitude") double longitude) { this.location = new Point(longitude, latitude); }