• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java WGS84Point类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中ch.hsr.geohash.WGS84Point的典型用法代码示例。如果您正苦于以下问题:Java WGS84Point类的具体用法?Java WGS84Point怎么用?Java WGS84Point使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



WGS84Point类属于ch.hsr.geohash包,在下文中一共展示了WGS84Point类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: rangeOnSameRoute

import ch.hsr.geohash.WGS84Point; //导入依赖的package包/类
/**
    * To get the range.
    * @param center
    * @param radius
    * @return LnikedList<> {lowk,uppk}
    */
   private static LinkedList<double[]> rangeOnSameRoute(Location center,double radius){
WGS84Point WGS84center = new WGS84Point(center.getLatitude(),center.getLongitude());
WGS84Point WGS84NorthEast = VincentyGeodesy.moveInDirection(VincentyGeodesy.moveInDirection(WGS84center, 0, radius), 90,radius);
WGS84Point WGS84SouthWest = VincentyGeodesy.moveInDirection(VincentyGeodesy.moveInDirection(WGS84center, 180, radius),270, radius);

double[] uppk = {Integer.MAX_VALUE,
		Integer.MAX_VALUE,
		Integer.MAX_VALUE,
		WGS84NorthEast.getLongitude(),
		WGS84NorthEast.getLatitude()};

double[] lowk = {0,
		0,
		0,
		WGS84SouthWest.getLongitude(),
		WGS84SouthWest.getLatitude()};

LinkedList<double[]> range = new LinkedList<double[]>();
range.add(lowk);
range.add(uppk);
return range;
   }
 
开发者ID:wang3,项目名称:ISPRSODC,代码行数:29,代码来源:SpatialSearcher.java


示例2: apply

import ch.hsr.geohash.WGS84Point; //导入依赖的package包/类
@Override
public Object apply(List<Object> args, Context context) throws ParseException {
  if(args.size() < 1) {
    return null;
  }
  String hash = (String)args.get(0);
  if(hash == null) {
    return null;
  }

  Optional<WGS84Point> point = GeoHashUtil.INSTANCE.toPoint(hash);
  if(point.isPresent()) {
    Map<String, Object> ret = new HashMap<>();
    ret.put(GeoLiteDatabase.GeoProps.LONGITUDE.getSimpleName(), point.get().getLongitude());
    ret.put(GeoLiteDatabase.GeoProps.LATITUDE.getSimpleName(), point.get().getLatitude());
    return ret;
  }
  return null;
}
 
开发者ID:apache,项目名称:metron,代码行数:20,代码来源:GeoHashFunctions.java


示例3: filterRowKey

import ch.hsr.geohash.WGS84Point; //导入依赖的package包/类
@Override
public boolean filterRowKey(
        final byte[] buffer,
        final int offset,
        final int length)
{
    boolean filter;
    final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(buffer, offset, length);
    final DataInputStream dataInputStream = new DataInputStream(byteArrayInputStream);
    try
    {
        final long bits = dataInputStream.readLong();
        final double lon = dataInputStream.readDouble();
        final double lat = dataInputStream.readDouble();
        filter = !m_boundingBox.contains(new WGS84Point(lat, lon));
    }
    catch (IOException e)
    {
        filter = true;
    }
    return filter;
}
 
开发者ID:mraad,项目名称:HBaseToolbox,代码行数:23,代码来源:BoundingBoxFilter.java


示例4: getSearchHashes

import ch.hsr.geohash.WGS84Point; //导入依赖的package包/类
/**
 * Calculate the geo hash cells we need to query in order to cover all points within this query
 *
 * @return
 */
private Set<String> getSearchHashes() {
    GeoHashCircleQuery q = new GeoHashCircleQuery(new WGS84Point(lat, lon), radius);

    // Since the circle query doesn't have pre-defined precision, we need to calculate all the
    // relevant geohashes in our precision manually
    GeoHash center = GeoHash.withCharacterPrecision(lat, lon, precision);

    Set<String> hashKeys = new HashSet<>(8);
    Set<GeoHash> seen = new HashSet<>(8);
    Queue<GeoHash> candidates = new LinkedList<>();

    candidates.add(center);

    while (!candidates.isEmpty()) {
        GeoHash gh = candidates.remove();
        hashKeys.add(geoKey(gh.toBase32()));

        GeoHash[] neighbors = gh.getAdjacent();
        for (GeoHash neighbor : neighbors) {
            if (seen.add(neighbor) && q.contains(neighbor)) {
                candidates.add(neighbor);
            }
        }

    }
    return hashKeys;
}
 
开发者ID:RedisLabs,项目名称:ReSearch,代码行数:33,代码来源:FullTextFacetedIndex.java


示例5: apply

import ch.hsr.geohash.WGS84Point; //导入依赖的package包/类
@Test
void apply() {
	final double longitude = 10.0;
	final double latitude = 20.0;
	final Coordinate coordinate = new WGS84Point2Coordinate().apply(new WGS84Point(latitude, longitude));
	assertEquals(longitude, coordinate.x);
	assertEquals(latitude, coordinate.y);
}
 
开发者ID:adrianulbona,项目名称:jts-discretizer,代码行数:9,代码来源:WGS84Point2CoordinateTest.java


示例6: discretize

import ch.hsr.geohash.WGS84Point; //导入依赖的package包/类
@Test
void discretize() {
	final Coordinate coordinate1 = this.wgs84Point2Coordinate.apply(new WGS84Point(10.0, 10.0));
	final Coordinate coordinate2 = this.wgs84Point2Coordinate.apply(new WGS84Point(45.0, 10.0));
	final LineString lineString = new GeometryFactory().createLineString(
			new Coordinate[]{coordinate1, coordinate2});
	final Set<GeoHash> geoHashes = this.segmentDiscretizer.apply(lineString, 2);
	assertEquals(8, geoHashes.size());
	final Set<GeoHash> expected = of("s1", "s4", "s5", "sh", "sj", "sn", "sp", "u0").map(GeoHash::fromGeohashString)
			.collect(toSet());
	assertEquals(expected, geoHashes);
}
 
开发者ID:adrianulbona,项目名称:jts-discretizer,代码行数:13,代码来源:SegmentDiscretizerTest.java


示例7: apply

import ch.hsr.geohash.WGS84Point; //导入依赖的package包/类
@Test
void apply() {
	final double longitude = 10.0;
	final double latitude = 20.0;
	final WGS84Point point = new Coordinate2WGS84Point().apply(new Coordinate(longitude, latitude));
	assertEquals(longitude, point.getLongitude());
	assertEquals(latitude, point.getLatitude());
}
 
开发者ID:adrianulbona,项目名称:jts-discretizer,代码行数:9,代码来源:Coordinate2WGS84PointTest.java


示例8: testEncodeDecode

import ch.hsr.geohash.WGS84Point; //导入依赖的package包/类
@Test
public void testEncodeDecode() throws Exception
{
    for (int i = 0; i < 100; i++)
    {
        final double lon = -180 + 360 * Math.random();
        final double lat = -90 + 180 * Math.random();
        final WGS84Point point = Quad.decode(Quad.encode(lon, lat)).getCenterPoint();
        assertEquals(lat, point.getLatitude(), 0.000001);
        assertEquals(lon, point.getLongitude(), 0.000001);
    }
}
 
开发者ID:mraad,项目名称:HBaseToolbox,代码行数:13,代码来源:QuadTest.java


示例9: scanBox

import ch.hsr.geohash.WGS84Point; //导入依赖的package包/类
private void scanBox(final HTableInterface table) throws IOException
{
    final List<WGS84Point> list = new ArrayList<WGS84Point>();
    final BoundingBox boundingBox = new BoundingBox(0.5, 1.5, 0.5, 1.5);
    final GeoHashBoundingBoxQuery geoHashBoundingBoxQuery = new GeoHashBoundingBoxQuery(boundingBox);
    final List<GeoHash> searchHashes = geoHashBoundingBoxQuery.getSearchHashes();
    for (final GeoHash geoHash : searchHashes)
    {
        scanGeoHash(table, geoHash, boundingBox, list);
    }
    Assert.assertEquals(1, list.size());
    final WGS84Point point = list.get(0);
    Assert.assertEquals(1.0, point.getLatitude(), 0.000001);
    Assert.assertEquals(1.0, point.getLongitude(), 0.000001);
}
 
开发者ID:mraad,项目名称:HBaseToolbox,代码行数:16,代码来源:BoundingBoxScanTest.java


示例10: scanGeoHash

import ch.hsr.geohash.WGS84Point; //导入依赖的package包/类
private void scanGeoHash(
        final HTableInterface table,
        final GeoHash geoHash,
        final BoundingBox boundingBox,
        final List<WGS84Point> list) throws IOException
{
    final Scan scan = new Scan();
    scan.setStartRow(Bytes.toBytes(geoHash.longValue()));
    scan.setStopRow(Bytes.toBytes(geoHash.next().longValue()));
    scan.setMaxVersions(1);
    scan.setCaching(50);
    scan.setFilter(new BoundingBoxFilter(boundingBox));
    final ResultScanner scanner = table.getScanner(scan);
    try
    {
        for (final Result result : scanner)
        {
            final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(result.getRow());
            final DataInput dataInput = new DataInputStream(byteArrayInputStream);
            final long bits = dataInput.readLong();
            final double lon = dataInput.readDouble();
            final double lat = dataInput.readDouble();
            list.add(new WGS84Point(lat, lon));
        }
    }
    finally
    {
        scanner.close();
    }
}
 
开发者ID:mraad,项目名称:HBaseToolbox,代码行数:31,代码来源:BoundingBoxScanTest.java


示例11: nearNYC

import ch.hsr.geohash.WGS84Point; //导入依赖的package包/类
public static boolean nearNYC(double latitude, double longitude) {
  return NYC.stream().anyMatch(hash -> hash.contains(new WGS84Point(latitude, longitude)));
}
 
开发者ID:awslabs,项目名称:flink-stream-processing-refarch,代码行数:4,代码来源:GeoUtils.java


示例12: nearJFK

import ch.hsr.geohash.WGS84Point; //导入依赖的package包/类
public static boolean nearJFK(double latitude, double longitude) {
  return JFK.stream().anyMatch(hash -> hash.contains(new WGS84Point(latitude, longitude)));
}
 
开发者ID:awslabs,项目名称:flink-stream-processing-refarch,代码行数:4,代码来源:GeoUtils.java


示例13: nearLGA

import ch.hsr.geohash.WGS84Point; //导入依赖的package包/类
public static boolean nearLGA(double latitude, double longitude) {
  return LGA.stream().anyMatch(hash -> hash.contains(new WGS84Point(latitude, longitude)));
}
 
开发者ID:awslabs,项目名称:flink-stream-processing-refarch,代码行数:4,代码来源:GeoUtils.java


示例14: wgs84Point2Coordinate

import ch.hsr.geohash.WGS84Point; //导入依赖的package包/类
private Function<WGS84Point, Coordinate> wgs84Point2Coordinate() {
	return new WGS84Point2Coordinate();
}
 
开发者ID:adrianulbona,项目名称:jts-discretizer,代码行数:4,代码来源:DiscretizerFactoryImpl.java


示例15: coordinate2WGS84Point

import ch.hsr.geohash.WGS84Point; //导入依赖的package包/类
private Function<Coordinate, WGS84Point> coordinate2WGS84Point() {
	return new Coordinate2WGS84Point();
}
 
开发者ID:adrianulbona,项目名称:jts-discretizer,代码行数:4,代码来源:DiscretizerFactoryImpl.java


示例16: apply

import ch.hsr.geohash.WGS84Point; //导入依赖的package包/类
@Override
public Coordinate apply(@NonNull WGS84Point wgs84Point) {
	return new Coordinate(wgs84Point.getLongitude(), wgs84Point.getLatitude());
}
 
开发者ID:adrianulbona,项目名称:jts-discretizer,代码行数:5,代码来源:WGS84Point2Coordinate.java


示例17: apply

import ch.hsr.geohash.WGS84Point; //导入依赖的package包/类
public GeoHash apply(@NonNull Coordinate coordinate, @NonNull Integer precision) {
	final WGS84Point point = this.coordinate2WGS84Point.apply(coordinate);
	return GeoHash.withCharacterPrecision(point.getLatitude(), point.getLongitude(), precision);
}
 
开发者ID:adrianulbona,项目名称:jts-discretizer,代码行数:5,代码来源:CoordinateDiscretizer.java


示例18: apply

import ch.hsr.geohash.WGS84Point; //导入依赖的package包/类
@Override
public WGS84Point apply(@NonNull Coordinate coordinate) {
	return new WGS84Point(coordinate.y, coordinate.x);
}
 
开发者ID:adrianulbona,项目名称:jts-discretizer,代码行数:5,代码来源:Coordinate2WGS84Point.java


示例19: c1

import ch.hsr.geohash.WGS84Point; //导入依赖的package包/类
protected Coordinate c1() {
	return coordinate(new WGS84Point(46.760796734739515, 23.62060546875));
}
 
开发者ID:adrianulbona,项目名称:jts-discretizer,代码行数:4,代码来源:GeometryDiscretizerTestBase.java


示例20: c2

import ch.hsr.geohash.WGS84Point; //导入依赖的package包/类
private Coordinate c2() {
	return coordinate(new WGS84Point(47.0160778535083, 21.8408203125));
}
 
开发者ID:adrianulbona,项目名称:jts-discretizer,代码行数:4,代码来源:GeometryDiscretizerTestBase.java



注:本文中的ch.hsr.geohash.WGS84Point类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java StructureVillagePieceWeight类代码示例发布时间:2022-05-23
下一篇:
Java WorldGenMelon类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap