code: public static long getTileRow(BoundingBox totalBox, long matrixHeight,
  			double latitude) {
  
  		double minY = totalBox.getMinLatitude();
  		double maxY = totalBox.getMaxLatitude();
  
  		long tileId;
  		if (latitude <= minY) {
  			tileId = matrixHeight;
  		} else if (latitude > maxY) {
  			tileId = -1;
  		} else {
  			double matrixHeightMeters = totalBox.getMaxLatitude()
  					- totalBox.getMinLatitude();
  			double tileHeight = matrixHeightMeters / matrixHeight;
  			tileId = (long) ((maxY - latitude) / tileHeight);
  		}
  
  		return tileId;
  	}
docs: Get the tile row of the latitude in constant units
  
  @param totalBox
  total bounding box
  @param matrixHeight
  matrix height
  @param latitude
  in constant units
  @return tile row if in the range, -1 if before,
  {@link TileMatrix#getMatrixHeight()} if after