Comments (9)
I tried your clip branch and it works! Thanks for taking care of this so quickly, I hope we'll see this code in a new mainline release soon.
from mapbox-vector-tile-java.
We can try out a scenario / option supporting clipping outside the tile boundary by some buffer distance. It would be correct to say that the tiles are clipped on the boundary.
Question: How are you styling the vector tiles? I imagine clipping on the boundary might be causing issues with styles that use an outline on the geometry?
from mapbox-vector-tile-java.
Another question... does the leaflet plugin use the protobuf id field at all for reconstructing polygons?
from mapbox-vector-tile-java.
The leaflet plugin's documentation tells me there should indeed be a buffer around the tile envelope, and if I'm correct there's no parameter for specifying that.
from mapbox-vector-tile-java.
As for the id fieldn do not know for suee, but I do see polygons highlighted as one feature, so they are matched somehow.
from mapbox-vector-tile-java.
Do you want to try the clip_buffering branch at https://github.com/wdtinc/mapbox-vector-tile-java/tree/clip_buffering ? There is a new overload for JtsAdapter#createTileGeom() that supports passing in a clipping envelope as a new parameter.
/**
* <p>Create geometry clipped and then converted to MVT 'extent' coordinates. Result
* contains both clipped geometry (intersection) and transformed geometry for encoding to MVT.</p>
*
* <p>Allows specifying separate tile and clipping coordinates. {@code clipEnvelope} can be bigger than
* {@code tileEnvelope} to have geometry exist outside the MVT tile extent.</p>
*
* @param g original 'source' geometry, passed through {@link #flatFeatureList(Geometry)}
* @param tileEnvelope world coordinate bounds for tile, used for transforms
* @param clipEnvelope world coordinates to clip tile by
* @param geomFactory creates a geometry for the tile envelope
* @param mvtLayerParams specifies vector tile properties
* @param filter geometry values that fail filter after transforms are removed
* @return tile geometry result
* @see TileGeomResult
*/
public static TileGeomResult createTileGeom(List<Geometry> g,
Envelope tileEnvelope,
Envelope clipEnvelope,
GeometryFactory geomFactory,
MvtLayerParams mvtLayerParams,
IGeometryFilter filter) {
...
I've created an example test in MvtBuiltTest#testBufferedPolygon()
// Create input geometry
final GeometryFactory geomFactory = new GeometryFactory();
final Geometry inputGeom = buildPolygon(RANDOM, 200, geomFactory);
// Build tile envelope - 1 quadrant of the world
final double tileWidth = WORLD_SIZE * .5d;
final double tileHeight = WORLD_SIZE * .5d;
final Envelope tileEnvelope = new Envelope(0d, tileWidth, 0d, tileHeight);
// Build clip envelope - (10 * 2)% buffered area of the tile envelope
final Envelope clipEnvelope = new Envelope(tileEnvelope);
final double bufferWidth = tileWidth * .1f;
final double bufferHeight = tileHeight * .1f;
clipEnvelope.expandBy(bufferWidth, bufferHeight);
// Build buffered MVT tile geometry
final TileGeomResult bufferedTileGeom = JtsAdapter.createTileGeom(
JtsAdapter.flatFeatureList(inputGeom),
tileEnvelope, clipEnvelope, geomFactory,
DEFAULT_MVT_PARAMS, ACCEPT_ALL_FILTER);
// Create MVT layer
final VectorTile.Tile mvt = encodeMvt(DEFAULT_MVT_PARAMS, bufferedTileGeom);
from mapbox-vector-tile-java.
Screenshot shows original random geometry hull (dark green), tile geometry (brown), clip geometry (light green).
from mapbox-vector-tile-java.
Should be able to push this to maven central soon as a new version soon in combination with some new README info.
from mapbox-vector-tile-java.
Closed via #6
from mapbox-vector-tile-java.
Related Issues (20)
- Android API Level 15 compatibility HOT 14
- Decoding tiles from Thunderforest results in InvalidProtocolBufferException HOT 4
- Polygons crossing the Antimeridian HOT 17
- Layer Equality Failure HOT 2
- Issue with mvt generation for polygon geometry HOT 3
- Issue with mvt generation for line geometry HOT 4
- How to add JtsLayer(or VectorTile.Tile) object to android mapbox map? HOT 1
- how to add vector to mapbox android HOT 1
- Performance tuning HOT 4
- Upgrade to locationtech JTS core 1.16.1 HOT 6
- Locationtech JTS core to 1.15.1 HOT 1
- Polygon orientation HOT 6
- JtsAdapter calculate polygon area wrong
- JtsAdapter is swallowing it's exception HOT 2
- Decoding Vector Tile file into a geoGSON file
- LinearRing HOT 1
- Was 3.1.1 ever pushed? HOT 8
- Question: createTileGeom Envelope/MvtLayerParams
- Upgrade to JTS 1.17.0 HOT 10
- Failure to parse when there is MULTILINESTRING HOT 1
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 mapbox-vector-tile-java.