源码部署失败
老师我使用这套源码,搭建网站失败,尝试多次无果,如何解决
你怎么部署的,发报错信息
(myenv) locus@locus:~/cntms$ ls
demo.html LICENSE prcoords.py README.md requirements.txt tmsapi.ini tms.py
(myenv) locus@locus:~/cntms$ python tms.py
Traceback (most recent call last):
File "tms.py", line 20, in
报了这样一个错误,File "tms.py", line 20, in 我在20行看见有这样import pycurl查了下是个模块,随后安装了该模块,可错误依旧
(myenv) locus@locus:~/cntms$ sudo apt-get install python3-pycurl 正在读取软件包列表... 完成 正在分析软件包的依赖关系树 正在读取状态信息... 完成 下列软件包是自动安装的并且现在不需要了: libfwupdplugin1 libxmlb1 使用'sudo apt autoremove'来卸载它(它们)。 建议安装: libcurl4-gnutls-dev python-pycurl-doc python3-pycurl-dbg 下列【新】软件包将被安装: python3-pycurl 升级了 0 个软件包,新安装了 1 个软件包,要卸载 0 个软件包,有 0 个软件包未被升级。 需要下载 46.9 kB 的归档。 解压缩后会消耗 196 kB 的额外空间。 获取:1 https://mirrors.aliyun.com/ubuntu focal/main amd64 python3-pycurl amd64 7.43.0.2-1ubuntu5 [46.9 kB] 已下载 46.9 kB,耗时 1秒 (79.8 kB/s) 正在选中未选择的软件包 python3-pycurl。 (正在读取数据库 ... 系统当前共安装有 115557 个文件和目录。) 准备解压 .../python3-pycurl_7.43.0.2-1ubuntu5_amd64.deb ... 正在解压 python3-pycurl (7.43.0.2-1ubuntu5) ... 正在设置 python3-pycurl (7.43.0.2-1ubuntu5) ... (myenv) locus@locus:~/cntms$
我使用的Ubuntu Server 20.4.3
sudo apt-get install python3-pycurl python3-tornado python3-pil python3-certifi
装这几样东西
安装了上面的东西,依然出现下面错误
(myenv) locus@locus:~/cntms$ python tms.py
Traceback (most recent call last):
File "tms.py", line 20, in
需要安装nginx还是Apache web访问端口是6700吗?
克隆下来的源码不需要修改什么吧?
No module named 'pycurl'
这个是你在系统里安装了,myenv 环境里没有,需要在 myenv 里用 pip 安装 pycurl 等依赖。
web访问端口是6700吗?克隆下来的源码不需要修改什么吧?
默认端口 6700,在 tmsapi.ini 里的 CONFIG 段可以修改;默认监听本地 127.0.0.1 nginx/apache 可以不用,如果需要挂其他服务、https、做缓存之类的可以加。
tmsapi.ini 里可以额外增加你自己的地图源,arcgis 导出的 type=arcgis,无偏移的 type 可以去掉。
收到,我在折腾试试看,完全不懂pyton,搞的头蒙的,谢谢老师
又尝试搞了几个小时,虽然安装了pycurl 等依赖,不在报错可是不能显示地图页面... 明天继续折腾
老师我这终于折腾出来了,但是发现一个问题,怎么才能使用512切片呢 像是谷歌定义的切片有4种分别是 scale=1 256 scale=2 512 scale=3 768 scale=4 1024 貌似只能使用256的切片,其它虽然也可以显示但是位置是错乱的 还有投影类型,像是谷歌和bing腾讯,这三家使用的投影也不一样,这个源码里有定义投影参数吗?
还一个问题我demo.html预览页面报404,不能在电脑上显示出来 (myenv) locus@locus:~/cntms$ python tms.py
404 GET /demo.html (192.168.5.10) 0.55ms 404 GET /favicon.ico (192.168.5.10) 0.61ms 404 GET /demo.html (192.168.5.10) 0.58ms 404 GET /intex.html (192.168.5.10) 0.55ms 404 GET /index.html (192.168.5.10) 0.51ms 404 GET /demo.html (104.28.217.215) 1.39ms 404 GET /favicon.ico (104.28.217.215) 1.35ms
怎么才能使用512切片呢
使用 url2x 指定源地址;代理地址为 /name/{z}/{x}/{y}@2x
像是谷歌和bing腾讯,这三家使用的投影也不一样,这个源码里有定义投影参数吗
谷歌的参考已有的地图源,type=xyz bing你试一下type=xyz 或者 type=tms 腾讯的参考已有的地图源,type=qq
预览页面报404
链接和列表页面在根目录 /,预览页面在 /map
[bing-satellite] name = 必应 卫星 url = http://t{s}.dynamic.tiles.ditu.live.com/comp/ch/{x}{y}{z}?mkt=zh-cn&it=A&shading=hill&og=8&n=z s = 0,1,2,3 type = tms attribution = © 2023 Microsoft
[bing-normal] name = 必应 地图 url = http://t{s}.dynamic.tiles.ditu.live.com/comp/ch/{x}{y}{z}?mkt=zh-cn&it=G,LC,BX,L&cstl=SN&shading=hill&og=1982&n=z s = 0,1,2,3 type = xyz attribution = © 2023 Microsoft
报500的错误 500: Internal Server Error
贴具体报错信息
Uncaught exception GET /bing-satellite/3/2/2 (104.28.217.213) HTTPServerRequest(protocol='http', host='map.xjhelp.cn:82', method='GET', uri='/bing-satellite/3/2/2', version='HTTP/1.1', remote_ip='104.28.217.213') Traceback (most recent call last): File "/home/locus/cntms/myenv/lib/python3.8/site-packages/tornado/web.py", line 1786, in _execute result = await result File "tms.py", line 887, in get res = await draw_tile( File "tms.py", line 797, in draw_tile res = await get_tile(source, realz, realx, realy, File "tms.py", line 714, in get_tile response = await HTTP_CLIENT.fetch(url, **client_kwargs) tornado.httpclient.HTTPClientError: HTTP 400: Bad Request 500 GET /bing-satellite/3/2/2 (104.28.217.213) 147.93ms Uncaught exception GET /bing-satellite/3/2/1 (104.28.217.213) HTTPServerRequest(protocol='http', host='map.xjhelp.cn:82', method='GET', uri='/bing-satellite/3/2/1', version='HTTP/1.1', remote_ip='104.28.217.213') Traceback (most recent call last): File "/home/locus/cntms/myenv/lib/python3.8/site-packages/tornado/web.py", line 1786, in _execute result = await result File "tms.py", line 887, in get res = await draw_tile( File "tms.py", line 797, in draw_tile res = await get_tile(source, realz, realx, realy, File "tms.py", line 714, in get_tile response = await HTTP_CLIENT.fetch(url, **client_kwargs) tornado.httpclient.HTTPClientError: HTTP 400: Bad Request 500 GET /bing-satellite/3/2/1 (104.28.217.213) 101.73ms 以上是必应爆错信息 我还遇见个BUG,我自己添加新的siweiearth图层,卫星图层能纠偏,矢量和注记图层,却无法纠偏 都是选择的type = gcj,卫星图能纠偏,其它两个图不能纠偏,对了卫星图是256的其它两个图是512的和这个切片大小有关系吗?
HTTPServerRequest(protocol='http', host='map.xjhelp.cn:82', method='GET', uri='/bing-normal/5/25/12', version='HTTP/1.1', remote_ip='192.168.5.1') Traceback (most recent call last): File "/home/locus/cntms/myenv/lib/python3.8/site-packages/tornado/web.py", line 1786, in _execute result = await result File "tms.py", line 887, in get res = await draw_tile( File "tms.py", line 787, in draw_tile res = await get_tile(source, z, x, y, retina, client_headers) File "tms.py", line 714, in get_tile response = await HTTP_CLIENT.fetch(url, **client_kwargs) tornado.httpclient.HTTPClientError: HTTP 400: Bad Request 500 GET /bing-normal/5/25/12 (192.168.5.1) 55368.61ms Uncaught exception GET /bing-normal/5/22/12 (192.168.5.1) HTTPServerRequest(protocol='http', host='map.xjhelp.cn:82', method='GET', uri='/bing-normal/5/22/12', version='HTTP/1.1', remote_ip='192.168.5.1') Traceback (most recent call last): File "/home/locus/cntms/myenv/lib/python3.8/site-packages/tornado/web.py", line 1786, in _execute result = await result File "tms.py", line 887, in get res = await draw_tile( File "tms.py", line 787, in draw_tile res = await get_tile(source, z, x, y, retina, client_headers) File "tms.py", line 714, in get_tile response = await HTTP_CLIENT.fetch(url, **client_kwargs) tornado.httpclient.HTTPClientError: HTTP 400: Bad Request 500 GET /bing-normal/5/22/12 (192.168.5.1) 55624.05ms
Bing 的问题是网址不对。
不能纠偏的话是表现为显示出来在原始坐标,还是在附近的其他位置,还是在大海里/其他很远的地方?
你再核对一下bing的网址,{x}{y}{z} 三个数字不可能连在一起的,有什么分隔符
切片地址 http://t0.dynamic.tiles.ditu.live.com/comp/ch/121333120003002010?mkt=zh-cn&it=A&shading=hill&og=8&n=z Locus Map 获取Bing图层参数 http://t{s}.dynamic.tiles.ditu.live.com/comp/ch/{c}?mkt=zh-cn&it=A&shading=hill&og=8&n=z oruxmaps 获取Bing图层参数 http://t{$s}.dynamic.tiles.ditu.live.com/comp/ch/{$q}?mkt=zh-cn&it=A&shading=hill&og=8&n=z 奥维获取 获取Bing图层参数 http://t{$serverpart}.dynamic.tiles.ditu.live.com/comp/ch/{$x}{$y}{$z}{4}?mkt=zh-cn&it=A&shading=hill&og=8&n=z 以上是我接触过的一些户外地图软件,他们都有特定参数来获取121333120003002010 我不知道在这套纠偏源码中应该填写什么参数
影像 https://aoweiservice.siweiearth.com/map/satellite/{$z}/{$y}/{$x} 矢量 https://aoweiservice.siweiearth.com/basemap/large/{$z}/{$y}/{$x} 这两个图使用同样的参数影像图可以纠偏,矢量图无法纠偏,影像256像素的,矢量512像素的