Comments (6)
You might display the bounds of each cellId, instead of it's center point. I think you'll see that there are various cell sizes (levels). You can avoid this feature - if you want to - by specifying the min/max cell levels that the S2RegionCoverer is allowed to return.
from s2-geometry-library-java.
@lokkju Thanks for reply!
I do want to keep one same level within the circle area and have set the min/max levels to be same, but it seems that it will still automatically replace four child cells with their parent as annotated by author for getCovering().
/**
- Return a normalized cell union that covers the given region and satisfies
- the restrictions EXCEPT for min_level() and level_mod(). These criteria
- cannot be satisfied using a cell union because cell unions are
- automatically normalized by replacing four child cells with their parent
- whenever possible. (Note that the list of cell ids passed to the cell union
- constructor does in fact satisfy all the given restrictions.)
*/
public S2CellUnion getCovering(S2Region region) {
S2CellUnion covering = new S2CellUnion();
getCovering(region, covering);
return covering;
}
Is there any alternatives to avoid this feature?
from s2-geometry-library-java.
you might try:
- getSimpleCovering
- loop through the S2CellUnion and emit children elements for any parent element above your desired level
- use reflection to call getCoveringInternal and get the raw S2CellIds
- a custom S2CellUnion that doesn't normalize the results (this code isn't at all tested, just gives you an idea):
public strictfp class S2CellUnionDenormalized extends S2CellUnion {
public void initSwap(ArrayList<S2CellId> cellIds) {
initRawSwap(cellIds);
// skip normalization
// normalize();
}
}
S2CellUnionDenormalized s2cud = new S2CellUnionDenormalized();
regionCoverer.getCovering(region, s2cud)
I'd probably suggest (1) or (2) as the best options.
from s2-geometry-library-java.
@lokkju Get it. Appreciate for your help!
from s2-geometry-library-java.
I'd suggest #5: use denormalize, to get the cells at the particular cell level you want.
from s2-geometry-library-java.
(Feel free to reopen if that doesn't work well for you)
from s2-geometry-library-java.
Related Issues (20)
- S2polygon.getCentroid seems wrong in some case? HOT 4
- S2CellCreation HOT 3
- Retrieve cell based on shortest distance
- Create cell by mentioning level HOT 1
- Support adding an offset to an S2LatLng, compute the heading/angle, etc.
- [BUG] OOM happened when S2RegionCoverer try to getCovering !!!
- [BUG] OOM happened when S2RegionCoverer try to getCovering !!! HOT 6
- bug in initToUnion HOT 3
- Query on polylines HOT 1
- S2RegionCoverer.getCoveringInternal Tries to cover whole globe! HOT 1
- Adding additional attribute to S2Polygon class for custom feature? HOT 4
- does S2 support maven version in repository? HOT 2
- Information: Library S2 Geometry in Kotlin exists
- Java port for S2RegionTermIndexer (c++) HOT 3
- S1Angle.fromEarthDistance HOT 1
- [FR] Are there J2CL annotations for this library? HOT 4
- Latest version in maven repo? HOT 9
- S2ContainsPointQuery - Different Result between Java and CPP HOT 1
- What's the unit of area being calculated in S2Cell class? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from s2-geometry-library-java.