Java Code Examples for org.locationtech.spatial4j.context.SpatialContext#getWorldBounds()

The following examples show how to use org.locationtech.spatial4j.context.SpatialContext#getWorldBounds() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GeohashPrefixTree.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
public GeohashPrefixTree(SpatialContext ctx, int maxLevels) {
  super(ctx, maxLevels);
  Rectangle bounds = ctx.getWorldBounds();
  if (bounds.getMinX() != -180)
    throw new IllegalArgumentException("Geohash only supports lat-lon world bounds. Got "+bounds);
  int MAXP = getMaxLevelsPossible();
  if (maxLevels <= 0 || maxLevels > MAXP)
    throw new IllegalArgumentException("maxLevels must be [1-"+MAXP+"] but got "+ maxLevels);
}
 
Example 2
Source File: RandomSpatialOpFuzzyPrefixTreeTest.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
private void setupCtx2D(SpatialContext ctx) {
  if (!ctx.isGeo())
    ctx2D = ctx;
  //A non-geo version of ctx.
  SpatialContextFactory ctxFactory = new SpatialContextFactory();
  ctxFactory.geo = false;
  ctxFactory.worldBounds = ctx.getWorldBounds();
  ctx2D = ctxFactory.newSpatialContext();
}
 
Example 3
Source File: QuadPrefixTree.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
public QuadPrefixTree(
    SpatialContext ctx, int maxLevels) {
  this(ctx, ctx.getWorldBounds(), maxLevels);
}