Package org.springframework.data.geo

Examples of org.springframework.data.geo.Point


   * @see DATAREST-279
   */
  @Test
  public void parsesPointFromString() {

    Point reference = new Point(20.9, 10.8);

    assertThat(INSTANCE.convert("10.8,20.9"), is(reference));
    assertThat(INSTANCE.convert(" 10.8,20.9 "), is(reference));
    assertThat(INSTANCE.convert(" 10.8 ,20.9"), is(reference));
    assertThat(INSTANCE.convert(" 10.8 , 20.9 "), is(reference));
View Full Code Here


   * @param latitude
   * @param longitude
   * @return
   */
  public static GeoHashFunction geohash(double latitude, double longitude) {
    return geohash(new Point(latitude, longitude));
  }
View Full Code Here

     * @param latitude
     * @param longitude
     * @return
     */
    public GeoDistanceFunction to(double latitude, double longitude) {
      return to(new Point(latitude, longitude));
    }
View Full Code Here

  public void setBoss(Person boss) {
    this.boss = boss;
  }
 
    public void setLocation(double lon, double lat) {
        this.wkt = new Point(lon,lat);
    }
View Full Code Here

    sampleEntity.setLocation(new GeoPoint(45.7806d, 3.0875d));

    repository.save(sampleEntity);

    // when
    Page<SampleEntity> page = repository.findByLocationWithin(new Point(3.0875d, 45.7806d), new Distance(2, Metrics.KILOMETERS), new PageRequest(0, 10));
    // then
    assertThat(page, is(notNullValue()));
    assertThat(page.getTotalElements(), is(equalTo(1L)));
  }
View Full Code Here

    // then
    assertThat(pageAll, is(notNullValue()));
    assertThat(pageAll.getTotalElements(), is(equalTo(2L)));

    // when
    Page<SampleEntity> page = repository.findByLocationNear(new Box(new Point(3d, 46d), new Point(4d, 45d)), new PageRequest(0, 10));
    // then
    assertThat(page, is(notNullValue()));
    assertThat(page.getTotalElements(), is(equalTo(1L)));
  }
View Full Code Here

    sampleEntity.setLocation(new GeoPoint(45.7806d, 3.0875d));

    repository.save(sampleEntity);

    // when
    Page<SampleEntity> page = repository.findByLocationNear(new Point(3.0875d, 45.7806d), new Distance(2, Metrics.KILOMETERS), new PageRequest(0, 10));
    // then
    assertThat(page, is(notNullValue()));
    assertThat(page.getTotalElements(), is(equalTo(1L)));
  }
View Full Code Here

    sampleEntity2.setLocation(new GeoPoint(30.7806d, 0.0875d));

    repository.save(sampleEntity2);

    // when
    long count = repository.countByLocationWithin(new Point(3.0875d, 45.7806d), new Distance(2, Metrics.KILOMETERS));
    // then
    assertThat(count, is(equalTo(1L)));
  }
View Full Code Here

    sampleEntity2.setLocation(new GeoPoint(30.7806d, 0.0875d));

    repository.save(sampleEntity2);

    // when
    long count = repository.countByLocationNear(new Box(new Point(3d, 46d), new Point(4d, 45d)));
    // then
    assertThat(count, is(equalTo(1L)));
  }
View Full Code Here

    sampleEntity2.setLocation(new GeoPoint(30.7806d, 0.0875d));

    repository.save(sampleEntity2);

    // when
    long count = repository.countByLocationNear(new Point(3.0875d, 45.7806d), new Distance(2, Metrics.KILOMETERS));
    // then
    assertThat(count, is(equalTo(1L)));
  }
View Full Code Here

TOP

Related Classes of org.springframework.data.geo.Point

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.