1 Star 0 Fork 19

Fank/MapTileGenerator

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
Apache-2.0

MapTileGenerator

支持TMS、WMTS标准瓦片下载,支持百度地图瓦片、高德地图瓦片、腾讯地图瓦片、天地图、ArcServer Rest瓦片、ArcServer本地缓存切片、geoserver WMS等瓦片下载。默认以png文件方式保存瓦片,也支持以sqlite(mbtiles格式)保存瓦片,支持瓦片base64编码后以sqlite保存(用于android端离线地图)。

使用说明:

设置mapConfig.json,根据配置项请求瓦片,支持多线程下载,失败续载。下载失败的瓦片用sqlite数据库保存在{savePath}\fails.db,第二次启动程序时会重新下载失败瓦片。程序运行中途退出时,第二次启动程序将会从上次退出的进度继续下载。

geoserver wms瓦片下载配置

{        
    "resolutions" :   [128, 64,32],  
    "tileSize" : [256,256],  
    "extent" : [12662882.864568064,2543518.577818389,12761187.939702341,2599303.8005401082],
    "origin": [0,0],
    "offsetZoom" :11,//resolutions如果设置了某一部分级别,必须要设置这个偏移量;
    "type" : "wms",
    "url": "http://localhost:8080/geoserver/szgas/wms",	
    "urlParas" : {
      "FORMAT" : "image/png",
      "VERSION" : "1.1.1",
      "STYLES" : "",
      "LAYERS" : "szgas:jd_baidu",
      "REQUEST" : "GetMap",
      "SRS" : "EPSG:3857",
      "TRANSPARENT" : true
    },
    "runThreadCount" : 5,
    "savePath" : "" //不设置保存路径,程序根目录是默认的瓦片保存路径;
    //,"output": "file"  //不设置output,则默认为png方式保存瓦片;
}

天地图WMTS瓦片下载配置

{
  "resolutions" :   [ 0.703125,  0.3515625, 0.17578125],
  "tileSize" : [256,256],
  "extent" : [-180.0 -90.0,180.0,90.0],
  "origin": [-180,90],
  "offsetZoom" :1,//resolutions如果设置了某一部分级别,必须要设置这个偏移量;
  "type" : "wmts",
  "url": "http://172.16.12.15:8080/dfc/services/ogc/wmts/vec",
  "urlParas" : {
    "SERVICE" : "WMTS",
    "FORMAT" : "image/png",
    "VERSION" : "1.0.0",
    "STYLES" : "default",
    "LAYER" : "vec",
    "REQUEST" : "GetTile",
    "TileMatrixSet" : "CustomCRS4326Scalevec",
    "TRANSPARENT" : true
  },
  "runThreadCount" : 5,
  "savePath" : ""
  //,"output": "file"  //不设置output,则默认为png方式保存瓦片;
}

天地图WMS下载

{
  "resolutions": [ 1.40625, 0.703125, 0.3515625 ],
  "tileSize": [ 256, 256 ],
  "extent": [ -180, -90, 180, 90 ],
  "origin": [ -180, -90 ],
  "offsetZoom": 1,//resolutions如果设置了某一部分级别,必须要设置这个偏移量;
  "type": "wms",
  "url": "http://www.scgis.net.cn/iMap/iMapServer/defaultRest/services/sctilemap/WMS",
  "urlParas": {
    "FORMAT": "image/png",
    "VERSION": "1.1.1",
    "STYLES": "",
    "LAYERS": "0",
    "REQUEST": "GetMap",
    "SRS": "EPSG:4326",
    "TRANSPARENT": true
  },
  "runThreadCount": 5,
  "savePath": ""
  //,"output": "file"  //不设置output,则默认为png方式保存瓦片;
}

ArcServerRest瓦片下载

{
  "resolutions": [
    0.0013732916427489112,
    0.0006866458213744556
  ],
  "tileSize": [ 256, 256 ],
  "extent": [ 107.86896617100007, 30.390792641000075, 108.90726196600006, 31.005204326000076 ],
  "origin": [ -400.0, 399.9999999999998 ],
  "offsetZoom": 0,//resolutions如果设置了某一部分级别,必须要设置这个偏移量;
  "type": "ArcServerRest",
  "url": "http://222.180.68.94:6080/arcgis/rest/services/wzpsp/wzmap/MapServer/tile/{z}/{y}/{x}",
  "runThreadCount": 1,
  "savePath": ""
  //,"output": "file"  //不设置output,则默认为png方式保存瓦片;
} 

ArcServer本地缓存的瓦片下载,目的是为了生成标准的WMTS xyz方式的瓦片或sqlite存储的瓦片

{
"resolutions": [   
          0.00015228550437313792,
          0.000076142752186568962,
          0.000038071376093284481,
          0.00001903568804664224,
          0.0000095178440233211202
          //,0.0000047589220116605601,
          //0.0000023794610058302801
],
"tileSize": [ 256, 256 ],
"extent": [ 113.3946038380694, 34.0858360155829, 113.5505441945475, 34.2026389974371 ],
"origin": [ -400.0, 400 ],
"offsetZoom": 3, //resolutions如果设置了某一部分级别,必须要设置这个偏移量;
"type": "ArcServerLocalTile",
"output": "sqlite", //用sqlite保存瓦片;默认是文件方式存储瓦片
"url": "http://192.168.20.34/YZMAP/{z}/{y}/{x}.png",
"runThreadCount": 1,
"savePath": ""

}

百度地图下载

{
  //"resolutions": [ 128, 64, 32 ],
  //"resolutions": [ 262144, 131072, 65536, 32768, 16384, 8192, 4096, 2048, 1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1 ],//完整的resolutions
  "resolutions": [  256,128,64,32,16 ],
  "offsetZoom": 10, //resolutions如果设置了某一部分级别,必须要设置这个偏移量;
  "tileSize": [ 256,256 ],
  "extent": [ 11808770.385317, 3403500.2612752, 11892674.468269, 3442476.25119 ],
  "origin": [ 0, 0 ],
  "type": "baidu",
  "output": "sqlite",//用sqlite保存瓦片;默认是png文件方式存储瓦片
   "url": "http://online3.map.bdimg.com/onlinelabel/?qt=tile&styles=pl&udt=20151021&scaler=1&p=1&qt=tile&x={x}&y={y}&z={z}",
  "runThreadCount":5
}

腾讯地图下载

{
  "resolutions": [  
      //156543.0339,  
      //78271.516953125,  
      //39135.7584765625,  
      //19567.87923828125,  
      9783.939619140625  
      ,4891.9698095703125  //测试需要,只下载2级;
      //,2445.9849047851562  
      //,1222.9924523925781  
      //,611.4962261962891,  
      //305.74811309814453,  
      //152.87405654907226,  
      //76.43702827453613,  
      //38.218514137268066,  
      //19.109257068634033,  
      //9.554628534317016,  
      //4.777314267158508, 
      //2.388657133579254,
      //1.194328566789627,
      //0.5971642833948135
  ],  
  "offsetZoom": 4, //resolutions如果设置了某一部分级别,必须要设置这个偏移量;
  "tileSize": [ 256, 256 ],
  "extent": [-20037508.342789244, -20037508.342789244, 20037508.342789244, 20037508.342789244],
  "origin": [-20037508.342789244, -20037508.342789244],
  "type": "tencent",
  "url": "http://rt1.map.gtimg.com/realtimerender?z={z}&x={x}&y={y}&type=vector&style=0&v=1.1.2",
  "runThreadCount": 1
  //不设置output,则默认为png方式保存瓦片;
}

高德地图下载

{
  "resolutions": [  
      //156543.0339,  
      //78271.516953125,  
      //39135.7584765625,  
      19567.87923828125,  
      9783.939619140625  
      //,4891.9698095703125  //测试需要,只下载2级;
      //,2445.9849047851562  
      //,1222.9924523925781  
      //,611.4962261962891,  
      //305.74811309814453,  
      //152.87405654907226,  
      //76.43702827453613,  
      //38.218514137268066,  
      //19.109257068634033,  
      //9.554628534317016,  
      //4.777314267158508, 
      //2.388657133579254,
      //1.194328566789627,
      //0.5971642833948135
  ],  
  "offsetZoom": 3, //resolutions如果设置了某一部分级别,必须要设置这个偏移量;
  "tileSize": [ 256, 256 ],
  "extent": [-20037508.342789244, -20037508.342789244, 20037508.342789244, 20037508.342789244],
  "origin": [-20037508.342789244, 20037508.342789244],
  "type": "gaode",
  "output": "sqliteAndBase64", //用sqlite保存瓦片,瓦片以base64方式编码;
  "url": "http://webrd01.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}",
  "runThreadCount": 1
}

瓦片规则

瓦片存储路径:{savePath}\Tiles\Zoom+offsetZoom\x\y.png Paste_Image.png

Paste_Image.png

Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

简介

MapTileGenerator 支持 TMS、WMTS 标准瓦片下载,支持百度地图瓦片、高德地图瓦片、腾讯地图瓦片、天地图、ArcGIS Rest、geoserver 等瓦片下载 展开 收起
README
Apache-2.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/hfting_admin/MapTileGenerator.git
git@gitee.com:hfting_admin/MapTileGenerator.git
hfting_admin
MapTileGenerator
MapTileGenerator
master

搜索帮助