Class WMTSTileSource
java.lang.Object
org.openstreetmap.gui.jmapviewer.tilesources.AbstractTileSource
org.openstreetmap.gui.jmapviewer.tilesources.AbstractTMSTileSource
org.openstreetmap.josm.data.imagery.WMTSTileSource
- All Implemented Interfaces:
org.openstreetmap.gui.jmapviewer.interfaces.Attributed,org.openstreetmap.gui.jmapviewer.interfaces.TemplatedTileSource,org.openstreetmap.gui.jmapviewer.interfaces.TileSource
public class WMTSTileSource
extends org.openstreetmap.gui.jmapviewer.tilesources.AbstractTMSTileSource
implements org.openstreetmap.gui.jmapviewer.interfaces.TemplatedTileSource
Tile Source handling WMTS providers
- Since:
- 8526
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classstatic classClass representing WMTS Layer informationprivate static final classprivate static final classstatic classclass representing WMTS TileMatrixSet This connects projection and TileMatrix (how the map is divided in tiles)private static final classstatic classException thrown when parser doesn't find expected information in GetCapabilities document -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intprivate doubleprivate WMTSTileSource.Layerprivate WMTSTileSource.TileMatrixSetprivate final DefaultLayerprivate final Collection<WMTSTileSource.Layer>private NativeScaleLayer.ScaleListprivate static final QNameprivate static final QNameprivate static final QNameprivate static final QNameprivate static final QNameprivate static final QNameprivate static final QNameprivate static final QNameprivate static final QNameprivate static final QNameprivate static final QNameprivate static final QNameprivate static final QNameprivate static final QNameprivate static final QNameprivate static final QNameprivate static final QNameprivate Projectionprivate final GetCapabilitiesParseHelper.TransferModeprivate static final Stringstatic final StringWMTS namespace addressFields inherited from class org.openstreetmap.gui.jmapviewer.tilesources.AbstractTMSTileSource
baseUrl, id, modTileFeatures, name, tileSizeFields inherited from class org.openstreetmap.gui.jmapviewer.tilesources.AbstractTileSource
attributionImage, attributionImageURL, attributionLinkURL, attributionText, termsOfUseText, termsOfUseURL -
Constructor Summary
ConstructorsConstructorDescriptionWMTSTileSource(ImageryInfo info) Creates a tile source based on imagery infoWMTSTileSource(ImageryInfo info, Projection projection) Creates a tile source based on imagery info and initializes it with given projection. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidChecks if url is acceptable by this Tile Sourcestatic WMTSCapabilitiesgetCapabilities(String url, Map<String, String> headers) Call remote server and parse response to WMTSCapabilities objectorg.openstreetmap.gui.jmapviewer.TileRangegetCoveringTileRange(org.openstreetmap.gui.jmapviewer.Tile tile, int newZoom) doublegetDistance(double lat1, double lon1, double lat2, double lon2) Layers that can be used with this tile sourceintGet native scales of tile source.Returns set of projection codes that this TileSource supports.getTileId(int zoom, int tilex, int tiley) private WMTSTileSource.TileMatrixgetTileMatrix(int zoom) Returns TileMatrix that's working on given zoom levelReturns the tile projection.private ProjectionBoundsgetTileProjectionBounds(org.openstreetmap.gui.jmapviewer.Tile tile) intgetTileUrl(int zoom, int tilex, int tiley) intgetTileXMax(int zoom) private intgetTileXMax(int zoom, Projection proj) intgetTileYMax(int zoom) private intgetTileYMax(int zoom, Projection proj) static List<Map.Entry<String,List<WMTSTileSource.Layer>>> Group layers by name and tile matrix set.voidinitProjection(Projection proj) Initializes projection for this TileSource with projectionbooleanisInside(org.openstreetmap.gui.jmapviewer.Tile inner, org.openstreetmap.gui.jmapviewer.Tile outer) org.openstreetmap.gui.jmapviewer.TileXYlatLonToTileXY(double lat, double lon, int zoom) latLonToXY(double lat, double lon, int zoom) private static BBoxparseBoundingBox(XMLStreamReader reader) Parses WGS84BoundingBox section.private static Collection<WMTSTileSource.Layer>parseContents(XMLStreamReader reader) Parse Contents tag.private static <T> TparseCoor(String coor, boolean switchXY, BiFunction<String, String, T> function) private static WMTSTileSource.DimensionparseDimension(XMLStreamReader reader) Gets Dimension value.private static EastNorthparseEastNorth(String coor, boolean switchXY) private static LatLonparseLatLon(String coor, boolean switchXY) private static WMTSTileSource.LayerparseLayer(XMLStreamReader reader) Parse Layer tag.private static WMTSCapabilitiesParses OperationMetadata section.private static WMTSTileSource.TileMatrixparseTileMatrix(XMLStreamReader reader, String matrixCrs) Parses TileMatrix section.private static WMTSTileSource.TileMatrixSetparseTileMatrixSet(XMLStreamReader reader) Parses TileMatrixSet section.private static StringGets TileMatrixSetLink value.org.openstreetmap.gui.jmapviewer.TileXYprojectedToTileXY(org.openstreetmap.gui.jmapviewer.interfaces.IProjected projected, int zoom) private EastNorthtileToEastNorth(int x, int y, int z) org.openstreetmap.gui.jmapviewer.interfaces.ICoordinatetileXYToLatLon(int x, int y, int zoom) org.openstreetmap.gui.jmapviewer.interfaces.IProjectedtileXYtoProjected(int x, int y, int zoom) Creates a dialog based on this tile source with all available layers and returns the name of selected layerorg.openstreetmap.gui.jmapviewer.CoordinatexyToLatLon(int x, int y, int zoom) Methods inherited from class org.openstreetmap.gui.jmapviewer.tilesources.AbstractTMSTileSource
getBaseUrl, getDefaultTileSize, getExtension, getId, getMetadata, getMinZoom, getName, getTilePath, getTileXMin, getTileYMin, isModTileFeatures, isNoTileAtZoom, toStringMethods inherited from class org.openstreetmap.gui.jmapviewer.tilesources.AbstractTileSource
getAttributionImage, getAttributionImageURL, getAttributionLinkURL, getAttributionText, getTermsOfUseText, getTermsOfUseURL, requiresAttribution, setAttributionImage, setAttributionImageURL, setAttributionLinkURL, setAttributionText, setTermsOfUseText, setTermsOfUseURLMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.openstreetmap.gui.jmapviewer.interfaces.Attributed
getAttributionImage, getAttributionImageURL, getAttributionLinkURL, getAttributionText, getTermsOfUseText, getTermsOfUseURL, requiresAttributionMethods inherited from interface org.openstreetmap.gui.jmapviewer.interfaces.TileSource
getDefaultTileSize, getId, getMetadata, getMinZoom, getName, getTileXMin, getTileYMin, isModTileFeatures, isNoTileAtZoom, latLonToTileXY, latLonToXY, tileXYToLatLon, tileXYToLatLon, xyToLatLon
-
Field Details
-
WMTS_NS_URL
WMTS namespace address- See Also:
-
QN_CONTENTS
-
QN_DEFAULT
-
QN_DIMENSION
-
QN_FORMAT
-
QN_LAYER
-
QN_MATRIX_WIDTH
-
QN_MATRIX_HEIGHT
-
QN_RESOURCE_URL
-
QN_SCALE_DENOMINATOR
-
QN_STYLE
-
QN_TILEMATRIX
-
QN_TILEMATRIXSET
-
QN_TILEMATRIX_SET_LINK
-
QN_TILE_WIDTH
-
QN_TILE_HEIGHT
-
QN_TOPLEFT_CORNER
-
QN_VALUE
-
URL_GET_ENCODING_PARAMS
- See Also:
-
cachedTileSize
-
headers
-
layers
-
currentLayer
-
currentTileMatrixSet
-
crsScale
-
transferMode
-
nativeScaleList
-
defaultLayer
-
tileProjection
-
-
Constructor Details
-
WMTSTileSource
public WMTSTileSource(ImageryInfo info) throws IOException, WMTSTileSource.WMTSGetCapabilitiesException Creates a tile source based on imagery info- Parameters:
info- imagery info- Throws:
IOException- if any I/O error occursWMTSTileSource.WMTSGetCapabilitiesException- when document didn't contain any layersIllegalArgumentException- if any other error happens for the given imagery info
-
WMTSTileSource
public WMTSTileSource(ImageryInfo info, Projection projection) throws IOException, WMTSTileSource.WMTSGetCapabilitiesException Creates a tile source based on imagery info and initializes it with given projection.- Parameters:
info- imagery infoprojection- projection to be used by this TileSource- Throws:
IOException- if any I/O error occursWMTSTileSource.WMTSGetCapabilitiesException- when document didn't contain any layersIllegalArgumentException- if any other error happens for the given imagery info- Since:
- 14507
-
-
Method Details
-
userSelectLayer
Creates a dialog based on this tile source with all available layers and returns the name of selected layer- Returns:
- Name of selected layer
-
getCapabilities
public static WMTSCapabilities getCapabilities(String url, Map<String, String> headers) throws IOException, WMTSTileSource.WMTSGetCapabilitiesExceptionCall remote server and parse response to WMTSCapabilities object- Parameters:
url- of the getCapabilities documentheaders- HTTP headers to set when calling getCapabilities url- Returns:
- capabilities
- Throws:
IOException- in case of any I/O errorWMTSTileSource.WMTSGetCapabilitiesException- when document didn't contain any layersIllegalArgumentException- in case of any other error
-
parseContents
private static Collection<WMTSTileSource.Layer> parseContents(XMLStreamReader reader) throws XMLStreamException Parse Contents tag. Returns when reader reaches Contents closing tag- Parameters:
reader- StAX reader instance- Returns:
- collection of layers within contents with properly linked TileMatrixSets
- Throws:
XMLStreamException- SeeXMLStreamReader
-
parseLayer
Parse Layer tag. Returns when reader will reach Layer closing tag- Parameters:
reader- StAX reader instance- Returns:
- Layer object, with tileMatrixSetLinks and no tileMatrixSet attribute set.
- Throws:
XMLStreamException- SeeXMLStreamReader
-
parseDimension
private static WMTSTileSource.Dimension parseDimension(XMLStreamReader reader) throws XMLStreamException Gets Dimension value. Returns when reader is on Dimension closing tag- Parameters:
reader- StAX reader instance- Returns:
- dimension
- Throws:
XMLStreamException- SeeXMLStreamReader
-
parseTileMatrixSetLink
Gets TileMatrixSetLink value. Returns when reader is on TileMatrixSetLink closing tag- Parameters:
reader- StAX reader instance- Returns:
- TileMatrixSetLink identifier
- Throws:
XMLStreamException- SeeXMLStreamReader
-
parseTileMatrixSet
private static WMTSTileSource.TileMatrixSet parseTileMatrixSet(XMLStreamReader reader) throws XMLStreamException Parses TileMatrixSet section. Returns when reader is on TileMatrixSet closing tag- Parameters:
reader- StAX reader instance- Returns:
- TileMatrixSet object
- Throws:
XMLStreamException- SeeXMLStreamReader
-
parseTileMatrix
private static WMTSTileSource.TileMatrix parseTileMatrix(XMLStreamReader reader, String matrixCrs) throws XMLStreamException Parses TileMatrix section. Returns when reader is on TileMatrix closing tag.- Parameters:
reader- StAX reader instancematrixCrs- projection used by this matrix- Returns:
- TileMatrix object
- Throws:
XMLStreamException- SeeXMLStreamReader
-
parseCoor
-
parseEastNorth
-
parseLatLon
-
parseBoundingBox
Parses WGS84BoundingBox section. Returns when reader is on WGS84BoundingBox closing tag.- Parameters:
reader- StAX reader instance- Returns:
- WGS84 bounding box
- Throws:
XMLStreamException- SeeXMLStreamReader
-
parseOperationMetadata
private static WMTSCapabilities parseOperationMetadata(XMLStreamReader reader) throws XMLStreamException Parses OperationMetadata section. Returns when reader is on OperationsMetadata closing tag. return WMTSCapabilities with baseUrl and transferMode- Parameters:
reader- StAX reader instance- Returns:
- WMTSCapabilities with baseUrl and transferMode set
- Throws:
XMLStreamException- SeeXMLStreamReader
-
initProjection
Initializes projection for this TileSource with projection- Parameters:
proj- projection to be used by this TileSource
-
getTileSize
- Specified by:
getTileSizein interfaceorg.openstreetmap.gui.jmapviewer.interfaces.TileSource- Overrides:
getTileSizein classorg.openstreetmap.gui.jmapviewer.tilesources.AbstractTMSTileSource
-
getTileUrl
- Specified by:
getTileUrlin interfaceorg.openstreetmap.gui.jmapviewer.interfaces.TileSource- Overrides:
getTileUrlin classorg.openstreetmap.gui.jmapviewer.tilesources.AbstractTMSTileSource
-
getTileMatrix
Returns TileMatrix that's working on given zoom level- Parameters:
zoom- zoom level- Returns:
- TileMatrix that's working on this zoom level
-
getDistance
- Specified by:
getDistancein interfaceorg.openstreetmap.gui.jmapviewer.interfaces.TileSource
-
tileXYToLatLon
public org.openstreetmap.gui.jmapviewer.interfaces.ICoordinate tileXYToLatLon(int x, int y, int zoom) - Specified by:
tileXYToLatLonin interfaceorg.openstreetmap.gui.jmapviewer.interfaces.TileSource
-
latLonToTileXY
- Specified by:
latLonToTileXYin interfaceorg.openstreetmap.gui.jmapviewer.interfaces.TileSource
-
getTileXMax
- Specified by:
getTileXMaxin interfaceorg.openstreetmap.gui.jmapviewer.interfaces.TileSource- Overrides:
getTileXMaxin classorg.openstreetmap.gui.jmapviewer.tilesources.AbstractTMSTileSource
-
getTileYMax
- Specified by:
getTileYMaxin interfaceorg.openstreetmap.gui.jmapviewer.interfaces.TileSource- Overrides:
getTileYMaxin classorg.openstreetmap.gui.jmapviewer.tilesources.AbstractTMSTileSource
-
latLonToXY
- Specified by:
latLonToXYin interfaceorg.openstreetmap.gui.jmapviewer.interfaces.TileSource
-
xyToLatLon
- Specified by:
xyToLatLonin interfaceorg.openstreetmap.gui.jmapviewer.interfaces.TileSource
-
getHeaders
- Specified by:
getHeadersin interfaceorg.openstreetmap.gui.jmapviewer.interfaces.TemplatedTileSource
-
getMaxZoom
- Specified by:
getMaxZoomin interfaceorg.openstreetmap.gui.jmapviewer.interfaces.TileSource- Overrides:
getMaxZoomin classorg.openstreetmap.gui.jmapviewer.tilesources.AbstractTMSTileSource
-
getTileId
- Specified by:
getTileIdin interfaceorg.openstreetmap.gui.jmapviewer.interfaces.TileSource- Overrides:
getTileIdin classorg.openstreetmap.gui.jmapviewer.tilesources.AbstractTMSTileSource
-
checkUrl
Checks if url is acceptable by this Tile Source- Parameters:
url- URL to check
-
groupLayersByNameAndTileMatrixSet
public static List<Map.Entry<String,List<WMTSTileSource.Layer>>> groupLayersByNameAndTileMatrixSet(Collection<WMTSTileSource.Layer> layers) Group layers by name and tile matrix set.- Parameters:
layers- to be grouped- Returns:
- list with entries - grouping identifier + list of layers
-
getSupportedProjections
Returns set of projection codes that this TileSource supports.- Returns:
- set of projection codes that this TileSource supports
-
getTileYMax
-
getTileXMax
-
getNativeScales
Get native scales of tile source.- Returns:
NativeScaleLayer.ScaleListof native scales
-
getTileProjection
Returns the tile projection.- Returns:
- the tile projection
-
tileXYtoProjected
public org.openstreetmap.gui.jmapviewer.interfaces.IProjected tileXYtoProjected(int x, int y, int zoom) - Specified by:
tileXYtoProjectedin interfaceorg.openstreetmap.gui.jmapviewer.interfaces.TileSource
-
projectedToTileXY
public org.openstreetmap.gui.jmapviewer.TileXY projectedToTileXY(org.openstreetmap.gui.jmapviewer.interfaces.IProjected projected, int zoom) - Specified by:
projectedToTileXYin interfaceorg.openstreetmap.gui.jmapviewer.interfaces.TileSource
-
tileToEastNorth
-
getTileProjectionBounds
-
isInside
public boolean isInside(org.openstreetmap.gui.jmapviewer.Tile inner, org.openstreetmap.gui.jmapviewer.Tile outer) - Specified by:
isInsidein interfaceorg.openstreetmap.gui.jmapviewer.interfaces.TileSource
-
getCoveringTileRange
public org.openstreetmap.gui.jmapviewer.TileRange getCoveringTileRange(org.openstreetmap.gui.jmapviewer.Tile tile, int newZoom) - Specified by:
getCoveringTileRangein interfaceorg.openstreetmap.gui.jmapviewer.interfaces.TileSource
-
getServerCRS
- Specified by:
getServerCRSin interfaceorg.openstreetmap.gui.jmapviewer.interfaces.TileSource
-
getLayers
Layers that can be used with this tile source- Returns:
- unmodifiable collection of layers available in this tile source
- Since:
- 13879
-