Package org.gvsig.mvtrenderer.lib.impl
Class MVTTile
java.lang.Object
org.gvsig.mvtrenderer.lib.impl.MVTTile
Represents a Mapbox Vector Tile and provides methods to download, parse, and render it.
- Author:
- fdiaz
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classData structure to hold a collection of features for a specific source layer. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddownload(InputStream is, org.locationtech.jts.geom.Envelope envelope, Map<String, Set<String>> fieldsByLayer) Parses a tile from an input stream.voiddownload(URL url, int z, int y, int x, org.locationtech.jts.geom.Envelope envelope, Map<String, Set<String>> fieldsByLayer) Downloads and parses a tile from a template URL by replacing {z}, {x}, and {y} placeholders.voiddownload(URL url, org.locationtech.jts.geom.Envelope envelope, Map<String, Set<String>> fieldsByLayer) Downloads and parses a tile from the given URL.Returns the folder path where tile data is stored.Renders the tile to a BufferedImage using the provided style.
-
Field Details
-
debugMode
public boolean debugMode
-
-
Constructor Details
-
MVTTile
public MVTTile()Default constructor. Only for test. -
MVTTile
public MVTTile(org.geotools.api.referencing.crs.CoordinateReferenceSystem tileCRS, org.geotools.api.referencing.crs.CoordinateReferenceSystem mapCRS) Constructor with CRS information.- Parameters:
tileCRS- The coordinate reference system of the tile.mapCRS- The coordinate reference system of the map.
-
-
Method Details
-
download
public void download(URL url, org.locationtech.jts.geom.Envelope envelope, Map<String, Set<String>> fieldsByLayer) throws IOExceptionDownloads and parses a tile from the given URL.- Parameters:
url- The URL to download the tile from.envelope- The envelope of the tile.fieldsByLayer- A map of field names to add for each layer.- Throws:
IOException- If an I/O error occurs.
-
download
public void download(URL url, int z, int y, int x, org.locationtech.jts.geom.Envelope envelope, Map<String, Set<String>> fieldsByLayer) throws IOExceptionDownloads and parses a tile from a template URL by replacing {z}, {x}, and {y} placeholders.- Parameters:
url- The template URL.z- The zoom level.y- The tile Y coordinate.x- The tile X coordinate.envelope- The envelope of the tile.fieldsByLayer- A map of field names to add for each layer.- Throws:
IOException- If an I/O error occurs.
-
download
public void download(InputStream is, org.locationtech.jts.geom.Envelope envelope, Map<String, Set<String>> fieldsByLayer) throws IOExceptionParses a tile from an input stream. Handles GZIP compression automatically.- Parameters:
is- The input stream containing the tile data.envelope- The envelope of the tile.fieldsByLayer- A map of field names to add for each layer.- Throws:
IOException- If an I/O error occurs.
-
render
Renders the tile to a BufferedImage using the provided style.- Parameters:
mvtStyle- The MVT style definition.widthInPixels- The width of the output image in pixels.heightInPixels- The height of the output image in pixels.- Returns:
- A BufferedImage containing the rendered tile.
-
getFolder
Returns the folder path where tile data is stored. Creates the folder if it doesn't exist. Only for test (see main).- Returns:
- The folder path string.
-