Integration of TileJSON with MicroJSON
Purpose
This specification outlines how to use TileJSON to integrate tiled MicroJSON data, both in json form as well as binary form. It provides examples of how TileJSON can be used to specify the tiling scheme and zoom levels for MicroJSON data and its binary equievalent. It is based on the TileJSON 3.0.0 specification, but extends it by recommending additional properties to enable integration of MicroJSON data and fit purposes of microscopy imaging. The recommendations provided here are not intrinsic to the original TileJSON specification but have been tailored to suit the needs of microscopy metadata annotation and integration with MicroJSON. However, all suggestions are designed to maintain compatibility with the original TileJSON specification.
Background of TileJSON
TileJSON is a widely-used format in mapping applications for specifying tilesets. Developed to streamline the integration of different map layers, TileJSON is essential for ensuring consistency across mapping platforms. It describes tilesets through a JSON object, detailing properties like tile URLs, zoom levels, and spatial coverage.
TileJSON for MicroJSON Object Structure
tilejson
: Specifies the version of the TileJSON spec being used. Required for all TileJSON objects.name
: The name of the tileset. Optional but recommended.description
: Provide a brief description of the tileset. Optional but recommended.version
: The version of the tileset. Optional but recommended.attribution
: A link to the data source or other attribution information, e.g. organisational origin. Optional but recommended.tiles
: Required. The URL pattern for accessing the vector tiles. Theurlbase/{zlvl}/{t}/{c}/{z}/{x}/{y}
is the recommended default naming pattern for the tiles, in this order, whereurlbase
is the base URL (e.g.http://example.com/tiles
),{zlvl}
is the zoom level,{t}
is the tileset timestamp,{c}
is the channel,{z}
is the z coordinate, and{x}
and{y}
are the x and y coordinates, respectively. If not using a timestamp, channel, or z coordinate, these can be omitted. The zoom level should always be first.minzoom
andmaxzoom
: Defines the range of zoom levels for which the tiles are available.bounds
: Optional. Specifies the geometrical bounds included in the tileset. Specified as an array of minimum four numbers in the order[minX, minY, maxX, maxY]
, but may include up to a further six numbers for a total of ten,[minT, minC, minZ, minX, minY, maxT, maxC, maxZ, maxX, maxY]
, whereminT
is the minimum tileset timestamp,minC
is the minimum channel,minZ
is the minimum z coordinate,minX
andminY
are the minimum x and y coordinates,maxT
is the maximum tileset timestamp,maxC
is the maximum channel,maxZ
is the maximum z coordinate, andmaxX
andmaxY
are the maximum x and y coordinates.center
: Optional. Indicates the center and suggested default view of the tileset. Minimum of three numbers in the order[x, y, zoom]
, but may include up to a further three numbers for a total of six,[t,c,z,x,y,zoom]
, wheret
is the tileset timestamp,c
is the channel,z
is the z coordinate,x
andy
are the x and y coordinates, andzoom
is the zoom level. Zoom level should be last.-
vector_layers
: Required. Describes each layer within the vector tiles, and has the following structure: -
id
: Required. A unique identifier for the layer. Required for each layer. fields
: Required. A list of fields (attributes) and their data types. For MicroJSON, this can either be an empty list, or a simple datatype indicator, that is either ofString
,Number
, orBool
. Complex data types, such as arrays or objects are not allowed. Required for each layer.fieldranges
: Optional. A dictionary of field names and their ranges. For example,{"label": [0,100], "channel": [0,10]}
. Optional.fieldenums
: Optional. A dictionary of field names and their possible values. For example,{"plate": ["A1", "A2", "B1", "B2"], "image": ["image1.tif", "image2.tif", "image3.tif"]}
. Optional.fielddescriptions
: Optional. A dictionary of field names and their descriptions. For example,{"plate": "Well plate identifier", "image": "Image filename", "label": "Label identifier", "channel": "Channel identifier"}
. Optional.description
: Optional. A brief description of the layer.minzoom
andmaxzoom
: Optional. The range of zoom levels at which the layer is visible.fillzoom
: Optional. An integer specifying the zoom level from which to generate overzoomed tiles.legend
: Optional. Contains a legend to be displayed with the tileset.multiscale
: Optional. A multiscale object as defined in the section Multiscale Object. If this property is not present, the default coordinate system is assumed to be the same as the image coordinate system, using cartesian coordinates and pixels as units.scale_factor
: Optional. A float specifying the scale factor for the tileset. If not present, the default value of 2 is assumed. Unless the use case requires a different scale factor, it is highly recommended to use the default value, as it is widely supported and assumed by many viewers.
The following fields of TileJSON may be used if the use case requires it, and are included here for completeness:
scheme
: The tiling scheme of the tileset.grids
: The URL pattern for accessing grid data.data
: Optional. The URL pattern for accessing data. Used for GeoJSON originally, which in this specification is replaced by MicroJSON and used in thetiles
field.template
: Optional. Contains a mustache template to be used to format data from grids for interaction.
Multiscale Object
A multiscale object represents the choice of axes (2-5D) and potentially their transformations that should be applied to the numerical data in order to arrive to the actual size of the object described. If the field is present, it MUST have the following properties:
"axes"
: Representing the choice of axes as an array of Axis objects.
It may contain either of, but NOT both of the following properties:
"coordinateTransformations"
: Representing the set of coordinate transformations that should be applied to the numerical data in order to arrive to the actual size of the object described. It MUST be an array of objects, each object representing a coordinate transformation. Each object MUST have properties as follows:"type"
: Representing the type of the coordinate transformation. Currently supported types are"identity"
,"scale"
, and"translate"
. If the type is"scale"
, the object MUST have the property"scale"
, representing the scaling factor. It MUST be an array of numbers, with the number of elements equal to the number of axes in the coordinate system. If the type is"translate"
, the object MUST have the property"translate"
, representing the translation vector. It MUST be an array of numbers, with the number of elements equal to the number of axes in the coordinate system. If the type is"identity"
, the object MUST NOT have any other properties."transformationMatrix"
: Representing the transformation matrix from the coordinate system of the image to the coordinate system of the MicroJSON object. It MUST be an array of arrays of numbers, with the number of rows equal to the number of axes in the coordinate system, and the number of columns equal to the number of axes in the image coordinate system. The transformation matrix MUST be invertible.
Axis Object
Together with the other axes in the axes array, an axis object represents the coordinate system of the MicroJSON object (2D-5D) It MUST have the following properties:
"name"
: Representing the name of the axis. It MUST be a string. It may contain the following properties:"unit"
: Representing the units of the corresponding axis of the geometries in the MicroJSON object. It MUST be an array with the elements having any of the following values:[“angstrom", "attometer", "centimeter", "decimeter", "exameter", "femtometer", "foot", "gigameter", "hectometer", "inch", "kilometer", "megameter", "meter", "micrometer", "mile", "millimeter", "nanometer", "parsec", "petameter", "picometer", "terameter", "yard", "yoctometer", "yottameter", "zeptometer", "zettameter“]
"description"
: A string describing the axis.
Pydantic Model for TileJSON for MicroJSON
TileJSON
Bases: RootModel
The root object of a TileJSON file.
Source code in src/microjson/tilemodel.py
200 201 202 |
|
TileModel
Bases: BaseModel
A TileJSON object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tilejson
|
str
|
The TileJSON version. |
required |
tiles
|
List[Union[Path, AnyUrl]]
|
The list of tile URLs. |
required |
name
|
Optional[str]
|
The name of the tileset. |
required |
description
|
Optional[str]
|
The description of the tileset. |
required |
version
|
Optional[str]
|
The version of the tileset. |
required |
attribution
|
Optional[str]
|
The attribution of the tileset. |
required |
template
|
Optional[str]
|
The template of the tileset. |
required |
legend
|
Optional[str]
|
The legend of the tileset. |
required |
scheme
|
Optional[str]
|
The scheme of the tileset. |
required |
grids
|
Optional[Union[Path, AnyUrl]]
|
The grids of the tileset. |
required |
data
|
Optional[Union[Path, AnyUrl]]
|
The data of the tileset. |
required |
minzoom
|
Optional[int]
|
The minimum zoom level of the tileset. |
required |
maxzoom
|
Optional[int]
|
The maximum zoom level of the tileset. |
required |
bounds
|
Optional[conlist(float, min_length=4, max_length=10)]
|
The bounds of the tileset. |
required |
center
|
Optional[conlist(float, min_length=3, max_length=6)]
|
The center of the tileset. |
required |
fillzoom
|
Optional[int]
|
The fill zoom level of the tileset. |
required |
vector_layers
|
List[TileLayer]
|
The vector layers of the tileset. |
required |
Source code in src/microjson/tilemodel.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 |
|
TileLayer
Bases: BaseModel
A vector layer in a TileJSON file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
str
|
The unique identifier for the layer. |
required |
fields
|
Union[None, Dict[str, str]]
|
The fields in the layer. |
required |
minzoom
|
Optional[int]
|
The minimum zoom level for the layer. |
required |
maxzoom
|
Optional[int]
|
The maximum zoom level for the layer. |
required |
description
|
Optional[str]
|
A description of the layer. |
required |
fieldranges
|
Optional[Dict[str, List[Union[int, float, str]]]]
|
The ranges of the fields. |
required |
fieldenums
|
Optional[Dict[str, List[str]]]
|
The enums of the fields. |
required |
fielddescriptions
|
Optional[Dict[str, str]]
|
The descriptions of the fields. |
required |
Source code in src/microjson/tilemodel.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
|
General tiling requirements
This specification is designed to be compatible with the Vector Tile Specification and the TileJSON 3.0.0 specification. The Vector Tile Specification specifically requires vector tiles to be agnostic of the global coordinate system, and thus followingly each tile has a relative coordinate system, which instead is defined in the TileJSON. Our ambitions in general are to follow the same principles.
One difference is that we here recommend that the file ending for binary tiles is .pbf
instead of .mvt
to avoid confusion with the Mapbox Vector Tile format. The binary tiles should be encoded in the Protobuf format as defined in the Vector Tile Specification.
MicroJSON2vt
The MicroJSON2vt module is a helper module that can be used to convert MicroJSON objects to vector tiles. It is designed to be used in conjunction with the TileJSON for MicroJSON specification, and can be used to generate vector tiles from MicroJSON objects. The module is designed to be compatible with the Vector Tile Specification, and can be used to generate vector tiles in the intermediate vector tile JSON-format, which then, using vt2pbf
may be transformed into protobuf. The module is included in the microjson
package, and its wrapper function can be imported using the following code:
from microjson import microjson2vt
The module:
MicroJsonVt class, which is the main class for generating vector tiles from MicroJSON data
Source code in src/microjson/microjson2vt/microjson2vt.py
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 |
|
__init__(data, options, log_level=logging.INFO)
Constructor for MicroJsonVt class
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
dict
|
The data to be converted to vector tiles |
required |
options
|
dict
|
The options to be used for generating vector tiles |
required |
log_level
|
int
|
The logging level to be used |
INFO
|
Source code in src/microjson/microjson2vt/microjson2vt.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
|
split_tile(features, z, x, y, cz=None, cx=None, cy=None)
Splits features from a parent tile to sub-tiles.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
features
|
list
|
The features to be split |
required |
z
|
int
|
The zoom level of the parent tile |
required |
x
|
int
|
The x coordinate of the parent tile |
required |
y
|
int
|
The y coordinate of the parent tile |
required |
cz
|
int
|
The zoom level of the target tile |
None
|
cx
|
int
|
The x coordinate of the target tile |
None
|
cy
|
int
|
The y coordinate of the target tile |
None
|
Source code in src/microjson/microjson2vt/microjson2vt.py
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 |
|
TileWriter module
The TileWriter module is a helper module that can be used to generate binary tiles from a large MicroJSON file, my utilizing both microjson2vt and vt2pbf.
TileWriter
Bases: TileHandler
Source code in src/microjson/tilewriter.py
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 |
|
microjson2tiles(microjson_data_path, validate=False, tolerance_key='default')
Generate tiles in form of JSON or PBF files from MicroJSON data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
microjson_data_path
|
Union[str, Path]
|
Path to the |
required |
validate
|
bool
|
Flag to indicate whether to validate |
False
|
Returns:
Type | Description |
---|---|
List[str]
|
List[str]: List of paths to the generated tiles |
Source code in src/microjson/tilewriter.py
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 |
|
extract_fields_ranges_enums(microjson_file)
Extract field names, ranges, and enums from the provided MicroJSON file. Returns: tuple: (dict with field names and types, dict of field ranges, dict of field enums)
Source code in src/microjson/tilewriter.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
|
getbounds(microjson_file, square=False)
Get the max and min bounds for coordinates of the MicroJSON file
Parameters:
Name | Type | Description | Default |
---|---|---|---|
microjson_file
|
str
|
Path to the MicroJSON file |
required |
square
|
bool
|
Flag to indicate whether to return square bounds |
False
|
Returns:
Type | Description |
---|---|
List[float]
|
List[float]: List of the bounds [minx, miny, maxx, maxy] |
Source code in src/microjson/tilewriter.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
|
An example of how to use the TileWriter module is located in the src/microjson/examples/tiling.py
file of the repository. The example demonstrates how to generate binary tiles from a large MicroJSON file.
TileReader module
Correspondingly, the TileReader module is a helper module that can be used to read binary tiles and convert them back to MicroJSON objects.
TileReader
Bases: TileHandler
Class to read tiles and generate MicroJSON data
Source code in src/microjson/tilereader.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
|
tiles2microjson(zlvl=0)
Generate MicroJSON data from tiles in form of JSON or PBF files. Get the TileJSON configuration and the PBF flag from the class attributes. Check that zlvl is within the maxzoom and minzoom of the tilejson Get the bounds from the tilejson and use to generate the MicroJSON data, by reading the tiles at the specified zoom level and extracting the geometries from the tiles.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
zlvl
|
int
|
The zoom level of the tiles to read |
0
|
Returns:
Name | Type | Description |
---|---|---|
dict |
dict[str, Any]
|
The generated MicroJSON data |
Source code in src/microjson/tilereader.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
|
An example of how to use the TileReader module is located in the src/microjson/examples/readtiles.py
file of the repository. The example demonstrates how to read binary tiles and convert them back to MicroJSON objects.
TileJSON for MicroJSON example with Vector Layers
The below example illustrates a TileJSON for a MicroJSON tileset multiple layers of detail. The tileset has a single vector layer, image_layer
id of vector_layers
, which contains a single vector layer describing images. The fields
property of the this layer specifies the attributes of the layer, including the data types of the attributes. The tiles
property specifies the URL pattern for accessing the vector tiles, which in this case is a 2D data set (no channels, time or z-axis) with zoom level.
This file is located in the examples/tiles
directory of the repository, and is named tiled_example.json
. It has a corresponding MicroJSON file for each tile, located in the examples/tiles/tiled_example
directory of the repository. The MicroJSON files are organized according to the tiling scheme, with the directory structure zlvl/x/y.json
where zlvl
is the zoom level, x
is the x coordinate, and y
is the y coordinate. The MicroJSON files contain the MicroJSON objects for the corresponding tiles, and are named according to the tiling scheme. For example, the MicroJSON object for the tile at zoom level 1, tile at (0,1) in the tiling scheme is located at examples/tiles/tiled_example/1/0/1.json
. Examples for MicroJSON objects at zoom levels 0, 1, and 2 are provided below.
{
{
"tilejson": "3.0.0",
"name": "2D Data Example",
"description": "A tileset showing 2D data with multiple layers of detail.",
"version": "1.0.0",
"attribution": "<a href='http://example.com'>Example</a>",
"tiles": [
"http://example.com/tiled_example/{zlvl}/{x}/{y}.json"
],
"minzoom": 0,
"maxzoom": 10,
"bounds": [0, 0, 24000, 24000],
"center": [12000, 12000, 0],
"vector_layers": [
{
"id": "Tile_layer",
"description": "Tile layer",
"minzoom": 0,
"maxzoom": 10,
"fields": {
"plate": "String",
"image": "String",
"label": "Number",
"channel": "Number"
}
}
],
"fillzoom": 3,
"multiscale": {
"axes": [
{
"name": "x",
"unit": "micrometer",
"type": "space",
"description": "x-axis"
},
{
"name": "y",
"unit": "micrometer",
"type": "space",
"description": "y-axis"
}
],
"transformationMatrix": [
[
1.0,
0.0,
0.0
],
[
0.0,
1.0,
0.0
],
[
0.0,
0.0,
0.0
]
]
}
}
Tiled binary TileJSON
In addition to json format, tiles may be encoded in a binary protobuf format. Below follows a similar example to the one above, but with binary tiles. The tiles
property specifies the URL pattern for accessing the binary tiles, which in this case is a 2D data set (no channels, time or z-axis) with zoom level. The fillzoom
property specifies the zoom level from which to generate overzoomed tiles, which in this case starts at level 3, after the last specified layer.
{
"tilejson": "3.0.0",
"name": "2D Data Example",
"description": "A tileset showing 2D data with multiple layers of detail.",
"version": "1.0.0",
"attribution": "<a href='http://example.com'>Example</a>",
"tiles": [
"http://example.com/tiled_example/{zlvl}/{x}/{y}.pbf"
],
"minzoom": 0,
"maxzoom": 10,
"bounds": [0, 0, 24000, 24000],
"center": [12000, 12000, 0],
"vector_layers": [
{
"id": "tile_layer",
"description": "Tile layer",
"minzoom": 0,
"maxzoom": 10,
"fields": {
"plate": "String",
"image": "String",
"label": "Number",
"channel": "Number",
},
"fieldranges": {
"label": [0,100],
"channel": [0,10]
},
"fieldenums": {
"plate": ["A1", "A2", "B1", "B2"],
"image": ["image1.tif", "image2.tif", "image3.tif"],
}
"fielddescriptions": {
"plate": "Well plate identifier",
"image": "Image filename",
"label": "Label identifier",
"channel": "Channel identifier"
}
}
],
"fillzoom": 3
}
Tiled binary example
The examples folder contains an example of how to generate binary tiles from one large MicroJSON file. It uses a helper module that generates a large random polygon grid, as could be expected in an imaging setting, using typical imaging coordinates. It is also included below for reference.
Example of creating binary tiles from a large MicroJSON file
Source code in src/microjson/examples/tiling.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
|
Tiled MicroJSON Example
Level 0
The following is an example of a MicroJSON object at zoom level 0, tile at (0,0) in the tiling scheme. Example URL: http://example.com/tiles/0/0/0.json
{
"tilejson": "3.0.0",
"name": "2D Data Example",
"description": "A tileset showing 2D data with multiple layers of detail.",
"version": "1.0.0",
"attribution": "<a href='http://example.com'>Example</a>",
"tiles": [
"http://example.com/tiled_example/{zlvl}/{x}/{y}.json"
],
"minzoom": 0,
"maxzoom": 10,
"bounds": [0, 0, 24000, 24000],
"center": [12000, 12000, 0],
"format": "json",
"vector_layers": [
{
"id": "image_layer",
"description": "Image layer",
"minzoom": 0,
"maxzoom": 10,
"fields": {
"plate": "String",
"image": "String",
"label": "Number",
"channel": "Number"
}
}
],
"fillzoom": 3
}
Level 1
The following is an example of a MicroJSON object at zoom level 1, tile at (0,1) in the tiling scheme. Example URL: http://example.com/tiles/1/0/1.json
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
0,
10000
],
[
10000,
10000
],
[
10000,
20000
],
[
0,
20000
],
[
0,
10000
]
]
]
},
"properties": {
"label": 3
}
}
],
"multiscale": {
"axes": [
{
"name": "x",
"type": "space",
"unit": "micrometer",
"description": "x-axis"
},
{
"name": "y",
"type": "space",
"unit": "micrometer",
"description": "y-axis"
}
]
},
"properties": {
"plate": "label",
"image": "x00_y01_p01_c1.ome.tif",
"channel": 1.0
}
}
Level 2
The following is an example of a MicroJSON object at zoom level 2, tile at (1,1) in the tiling scheme. Example URL: http://example.com/tiles/2/1/3.json
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
5000,
15000
],
[
10000,
15000
],
[
10000,
20000
],
[
5000,
20000
],
[
5000,
15000
]
]
]
},
"properties": {
"label": 13
}
}
],
"multiscale": {
"axes": [
{
"name": "x",
"type": "space",
"unit": "micrometer",
"description": "x-axis"
},
{
"name": "y",
"type": "space",
"unit": "micrometer",
"description": "y-axis"
}
]
},
"properties": {
"plate": "label",
"image": "x00_y01_p01_c1.ome.tif",
"channel": 1.0
}
}