Package dev.avelar.mapnik
Class UtfGrid
java.lang.Object
dev.avelar.mapnik.UtfGrid
A UTFGrid: a coarse picture in which each cell names the feature drawn there, so a web map can
highlight a feature or show its details when the pointer is over it. Get one from
MapnikMap.renderGrid(java.lang.String, java.lang.String, java.util.Collection<java.lang.String>, int), send toJson() to the browser, or look cells up here with
pixel coordinates of the image it accompanies.-
Method Summary
Modifier and TypeMethodDescriptionattributesAt(int pixelX, int pixelY) The attributes of the feature at a pixel, or an empty map where there is none.intcolumns()Cells across and down.The attribute data for one feature, or null if there is none for that key.intintSize in pixels of the image this grid covers.keyAt(int pixelX, int pixelY) The key of the feature at a pixel of the image, or an empty string where there is none.keys()The names of the features that appear in the grid, in order of first appearance.static UtfGridRead a UTFGrid from JSON, given the size of the image it covers and how many pixels make a cell.intPixels of the image per cell of the grid.introws()toJson()The JSON, ready to send to a web map.toString()
-
Method Details
-
parse
Read a UTFGrid from JSON, given the size of the image it covers and how many pixels make a cell. -
toJson
The JSON, ready to send to a web map. -
resolution
public int resolution()Pixels of the image per cell of the grid. -
imageWidth
public int imageWidth()Size in pixels of the image this grid covers. -
imageHeight
public int imageHeight() -
columns
public int columns()Cells across and down. -
rows
public int rows() -
keys
The names of the features that appear in the grid, in order of first appearance. -
data
The attribute data for one feature, or null if there is none for that key. -
keyAt
The key of the feature at a pixel of the image, or an empty string where there is none. -
attributesAt
The attributes of the feature at a pixel, or an empty map where there is none. -
toString
-