Class TileTools

java.lang.Object
cn.mapway.common.geo.tools.TileTools

public class TileTools extends Object
TileTools 瓦片工具,主要用于将GeoTiff切图存储在.S文件中 将一个文件切片的主要过程分为四部 打开输入 生产元数据 生成基本title 生成索引title TODO 解决连接池数量和关闭的问题
Author:
zhangjianshe <zhangjianshe@gmail.com>
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
     
    static final String
     
    static final int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    TileTools(String basePath)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    清空.S数据文件
    void
    copyTo(TileTools target, long xIndex, long yIndex, int zoom)
    拷贝瓦片到目标数据库中
    void
    delete(Integer x, Integer y, Integer level)
    删除数据库的一条记录
    boolean
    exists(Integer x, Integer y, Integer level)
    tile是否存在
    getDbFile(long xIndex, long yIndex, int zoom)
     
    guessFileFormat(byte[] data)
     
    rasterMask(long tileX, long tileY, int z, org.gdal.ogr.Geometry intersection)
    raster Geometry intersects box in tile tile (x,y,z)
    byte[]
    read(long xIndex, long yIndex, int zoom)
    S数据库中瓦片坐标 是左上角为原点 向上 向下生长 leaflet 采用这种坐标系统 注意 读取墨卡托 瓦片数据 瓦片坐标原点定位左上角 向下 向右生长
    void
    read(Integer x, Integer y, Integer level, OutputStream outputStream)
     
    readImage(long xIndex, long yIndex, int zoom)
    读取指定位置的图像
    cn.mapway.biz.core.BizResult<SFileExtend>
    搜索数据库找出该SFile的经纬度范围 此值是一个估计值,不是精确值 S文件中 tile编号是 左上角为原点 向右 向下生长 找到一个有值就返回
    boolean
    sureTable(Connection connection, String tableName, boolean create)
     
    static cn.mapway.geo.geometry.GeoObject
    toPolygon(cn.mapway.geo.shared.vector.Box box)
     
    void
    write(long xIndex, long yIndex, int zoom, InputStream data)
    写入指定位置图像 只有一个线程支持写操作
    void
    writeBytes(long xIndex, long yIndex, int zoom, byte[] data)
    写入数据
    void
    writeMetaFile(cn.mapway.geo.client.raster.ImageInfo info)
    当前目录下写入元数据信息

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • TileTools

      public TileTools(String basePath)
  • Method Details

    • toPolygon

      public static cn.mapway.geo.geometry.GeoObject toPolygon(cn.mapway.geo.shared.vector.Box box)
    • rasterMask

      public static BufferedImage rasterMask(long tileX, long tileY, int z, org.gdal.ogr.Geometry intersection)
      raster Geometry intersects box in tile tile (x,y,z)
      Parameters:
      tileX -
      tileY -
      z -
      intersection - webmercator cords' polygon
      Returns:
    • writeMetaFile

      public void writeMetaFile(cn.mapway.geo.client.raster.ImageInfo info)
      当前目录下写入元数据信息
      Parameters:
      info -
    • copyTo

      public void copyTo(TileTools target, long xIndex, long yIndex, int zoom)
      拷贝瓦片到目标数据库中
      Parameters:
      target -
      xIndex -
      yIndex -
      zoom -
    • write

      public void write(long xIndex, long yIndex, int zoom, InputStream data)
      写入指定位置图像 只有一个线程支持写操作
      Parameters:
      xIndex - tileX 坐标
      yIndex - tile Y坐标
      zoom - 图像Level
      data - 图像数据
    • writeBytes

      public void writeBytes(long xIndex, long yIndex, int zoom, byte[] data)
      写入数据
      Parameters:
      xIndex -
      yIndex -
      zoom -
      data -
    • read

      public byte[] read(long xIndex, long yIndex, int zoom)
      S数据库中瓦片坐标 是左上角为原点 向上 向下生长 leaflet 采用这种坐标系统 注意 读取墨卡托 瓦片数据 瓦片坐标原点定位左上角 向下 向右生长
      Parameters:
      xIndex - 瓦片X方向的索引
      yIndex - 瓦片Y方向的索引
      zoom - 瓦片级别
      Returns:
    • read

      public void read(Integer x, Integer y, Integer level, OutputStream outputStream)
    • readImage

      public BufferedImage readImage(long xIndex, long yIndex, int zoom)
      读取指定位置的图像
      Parameters:
      xIndex -
      yIndex -
      zoom -
      Returns:
    • getDbFile

      public String getDbFile(long xIndex, long yIndex, int zoom)
    • sureTable

      public boolean sureTable(Connection connection, String tableName, boolean create)
    • guessFileFormat

      public String guessFileFormat(byte[] data)
    • clear

      public void clear()
      清空.S数据文件
    • searchExtend

      public cn.mapway.biz.core.BizResult<SFileExtend> searchExtend()
      搜索数据库找出该SFile的经纬度范围 此值是一个估计值,不是精确值 S文件中 tile编号是 左上角为原点 向右 向下生长 找到一个有值就返回
      Returns:
    • exists

      public boolean exists(Integer x, Integer y, Integer level)
      tile是否存在
      Parameters:
      x -
      y -
      level -
      Returns:
    • delete

      public void delete(Integer x, Integer y, Integer level)
      删除数据库的一条记录
      Parameters:
      x -
      y -
      level -