当前位置: 首页 > news >正文

浏览器网站在线进入免费外链网盘

浏览器网站在线进入,免费外链网盘,网站域名备案转接入手续,上海建交人才网官网xyz地图服务访问示例#xff1a;http://192.168.1.240:8081/gmserver/raster/xyz/firstWP:Imagery-raster/{z}/{x}/{y}.jpg 访问示例如下#xff1a; mbtiles目录结构 根据z#xff0c;x#xff0c;y获取对应mbtiles文件路径的工具方法 说明#xff1a;重点是使用getMb…xyz地图服务访问示例http://192.168.1.240:8081/gmserver/raster/xyz/firstWP:Imagery-raster/{z}/{x}/{y}.jpg 访问示例如下 mbtiles目录结构 根据zxy获取对应mbtiles文件路径的工具方法 说明重点是使用getMbtilesPath方法通过xyz获取mbtiles文件路径。 getTilesFile方法是通过图层因为我做的项目是mbtiles数据集绑定在图层上获取对应的mbtiles文件。 package com.gs.springboot.gmserver.util;import com.gs.springboot.gmserver.core.CommonConstants; import org.geoserver.catalog.LayerInfo; import org.geoserver.catalog.StoreInfo;import java.io.File; import java.io.Serializable; import java.util.Collection; import java.util.Map;/*** Desc mbtiles工具类*/ public class MbtilesUtil {/*** 根据zxy索引mbtiles文件所在目录** param z 层级* param x 行* param y 列* param rootPath mbtiles根目录* return java.lang.String*/public static String getMbtilesPath(int z, int x, int y, String rootPath) {int p 0;//文件级别的列号int q 0;//文件级别的行号int m 0;//文件夹级别的列号int n 0;//文件夹级别的行号if (z 8) {p 0;q 0;m 0;n 0;} else if (z 9) {double fileTotal Math.pow(2, 2 * (z - 8));//文件总数double tileTotal 65536 * fileTotal;//瓦片总数double maxTileNum Math.sqrt(tileTotal);//行和列坐标轴方向的瓦片个数行列相等double segmentNum Math.sqrt(fileTotal);//行和列分的段数即行和列坐标轴方向的mbtiles文件个数double tileNumOfEachMbtiles maxTileNum / segmentNum;//单个mbtiles的最大行列的瓦片数行列瓦片数相等p (int) (x / tileNumOfEachMbtiles);q (int) (y / tileNumOfEachMbtiles);if (z 9 || z 10) {m 0;n 0;} else {double dirTotal fileTotal / 16;//文件夹总数double segmentDirNum Math.sqrt(dirTotal);//行和列坐标轴方向的最大文件夹个数行列相等double tileNumOfEachDir segmentNum / segmentDirNum;//每段文件夹内的mbtiles的个数m (int) (p / tileNumOfEachDir);n (int) (q / tileNumOfEachDir);}}String mbtiles_file rootPath / z / m _ n / z _ p _ q .mbtiles;return mbtiles_file;}/*** 通过图层信息索引瓦片对应文件* param layerInfo 图层* param tilecol 列x* param tilerow 行y* param z 层级z* param format 后缀* return java.io.File*/public static File getTilesFile(LayerInfo layerInfo, int tilecol, int tilerow, Integer z, String format) {StoreInfo store layerInfo.getResource().getStore();String type store.getType();File file null;MapString, Serializable connectionParameters store.getConnectionParameters();for (String key : connectionParameters.keySet()) {if (key.contains(filePath)) {Serializable value connectionParameters.get(key);String rootPath (String) value;String tilesPath null;if (type.equals(CommonConstants.DataStoreType.TilesFolderRaster.getValue())|| type.equals(CommonConstants.DataStoreType.TilesFolderVector.getValue())|| type.equals(CommonConstants.DataStoreType.TilesFolderDEM_terrain.getValue())) {tilesPath rootPath / z / tilecol / tilerow . format;} else if (type.equals(CommonConstants.DataStoreType.TilesFolderDEM_png.getValue())) {tilesPath rootPath / z / tilecol / tilerow .png;}else if (type.equals(CommonConstants.DataStoreType.MbtilesFolderRaster.getValue())|| type.equals(CommonConstants.DataStoreType.MbtilesFolderVector.getValue())|| type.equals(CommonConstants.DataStoreType.MbtilesFolderDEM.getValue())) {tilesPath getMbtilesPath(z, tilecol, tilerow, rootPath);}file new File(tilesPath);if (file.exists() file.length() 0) {break;}}}return file;}}发布mbtiles地图服务的接口。 说明此处由于是项目的完整功能所以代码是通过图层名称获取mbtiles的文件你也可以将layer直接换成mbtiles数据集的根目录或者直接写死根目录。通过xyz就可以访问瓦片。 package com.gs.springboot.gmserver.tiles;import cn.hutool.core.io.file.FileNameUtil; import com.gs.springboot.gmserver.core.CommonConstants; import com.gs.springboot.gmserver.util.MbtilesUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.apache.commons.io.IOUtils; import org.geoserver.catalog.Catalog; import org.geoserver.catalog.LayerInfo; import org.geoserver.catalog.StoreInfo; import org.imintel.mbtiles4j.MBTilesReadException; import org.imintel.mbtiles4j.MBTilesReader; import org.imintel.mbtiles4j.Tile; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController;import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import java.io.*; import java.util.concurrent.CompletableFuture;RestController Api(tags 栅格瓦片服务发布接口) public class RasterTilesController {Autowiredprivate Catalog catalog;GetMapping(/raster/xyz/{layer}/{z}/{x}/{y}.{format})ApiOperation(value 发布栅格Mbtiles文件夹数据XYZ服务)ApiImplicitParams({ApiImplicitParam(name layer, value 图层名称, dataType String, paramType path),ApiImplicitParam(name z, value z坐标, dataType int, paramType path),ApiImplicitParam(name x, value x坐标, dataType int, paramType path),ApiImplicitParam(name y, value y坐标, dataType int, paramType path),ApiImplicitParam(name format, value 格式, dataType String, paramType path)})public void publishXYZ(PathVariable(layer) String layer,PathVariable(z) int z,PathVariable(x) int x,PathVariable(y) int y,PathVariable(format) String format,HttpServletResponse response) {LayerInfo layerInfo catalog.getLayerByName(layer);StoreInfo store layerInfo.getResource().getStore();if (store.getConnectionParameters().get(scheme) ! null) {String scheme (String) store.getConnectionParameters().get(scheme);if (!CommonConstants.DataStoreScheme.XYZ.getValue().equals(scheme)) {y (1 z) - y - 1;//此处是将xyz转tms}}extracted(layerInfo, z, x, y, format, response);}private void extracted(LayerInfo layerInfo, int z, int x, int y, String format, HttpServletResponse response) {File file MbtilesUtil.getTilesFile(layerInfo, x, y, z, format);String prefix FileNameUtil.getSuffix(file);// 异步执行任务返回一个 CompletableFutureCompletableFutureVoid future CompletableFuture.runAsync(() - {InputStream data null;if (mbtiles.equals(prefix)) {MBTilesReader r null;Tile tile;try {r new MBTilesReader(file);tile r.getTile(z, x, y);} catch (MBTilesReadException e) {throw new RuntimeException(e);}data tile.getData();} try {if (png.equals(format) || jpg.equals(format)) {response.setContentType(image/ format);} else {response.setStatus(400);return;}ServletOutputStream oStream response.getOutputStream();IOUtils.copy(data, oStream);oStream.flush();oStream.close();} catch (IOException e) {throw new RuntimeException(e);}});// 等待 CompletableFuture 完成future.join();}}
http://www.laogonggong.com/news/127262.html

相关文章:

  • 泰安公司网站建设价格查询一半招聘网站海报格式都怎么做
  • 类似链家网站建设方案免费logo头像在线制作
  • 亿度网络 网站建设网站建设职业规划
  • 深圳自助网站建设费用商城网站功能介绍
  • 网站建设优選宙斯站长网站改版 目的
  • 南昌网站建设案例163企业邮箱怎么申请
  • 表单制作小程序专业网站优化方案
  • 上海网站开发技术最好公司平顶山建设街小学网站
  • 手机咋做网站网络规划设计师视频百度云
  • 凡科网站代理登录入口网页设计实训心得200字
  • 自己做网站编程珠海教育局系统网站
  • 网站建设的市场定位分析百度推广总部电话
  • 网站建设的软件昆明网站设计
  • 天猫网站的建设目标网站单页在线
  • 网站架构分类中国公关公司排行榜
  • 普洱高端网站建设价格房产网站建设产品
  • 网站开发教程视频百度云资源优设网址
  • 石家庄营销型网站制作seo技术优化
  • 网站开发工具和平台十大门户网站有哪些
  • 国家重点建设裤网站需要多少钱呢?
  • 帮别人做违法网站网站后台图片调换位置
  • 网站服务器购买价格大连网站制作赞ls15227
  • 做商城网站多少钱手机小程序在哪里找
  • 成都公司网站设计做铝锭的网站
  • 北京保障房建设项目网站吴江和城乡建设局网站
  • 网站建设丨找王科杰信誉万能优化大师下载
  • 网站做推荐链接端口企业管理培训课程好卖吗
  • 网站收录不稳定青岛的网站建设公司
  • 创建网站代码是什么情况ui设计师证
  • 天津在线制作网站河南中原建设公司网站