如何解决在示例示例中,如何从ClusterBuster矢量切片服务器接收切片数据?
摘要
似乎这些家伙在ClusterBuster矢量切片服务器上的内置过滤,群集和缓存方面做得很棒。 我对这个看起来非常有前途的项目感到非常兴奋,我很想尝试一下!
我正在一个项目中,通过矢量图块服务器通过Deck.gl在Google Maps上绘制MVTLayer层(integration)。 我想尝试整合并从ClusterBuster服务器提供一些保存在PostGIS中的聚集点。
预期结果:
- 我想像它们的provided sample example一样从ClusterBuster矢量切片服务器接收切片数据。
实际结果:
我的尝试
我尝试构建并运行提供的示例,但是以某种方式,我无法做到这一点。
我运行了提供的快递服务器clusterbuster/example/express.ts
,并使用clusterbuster/example/mapBox.html
中提供的mapBox示例(使用我的mapBox令牌)尝试了前端,但是在mapBox地图上(在我的Deck的Google地图上也没有出现)。 gl示例)。
如clusterbuster/example/readme.md
中所述,我使用PostGIS连接设置创建了一个.env
文件。
运行以下命令后:
yarn
yarn start
我得到以下输出:
C:\zFVStuff\Google Maps - Deck.gl\_Servers\ClusterBuster\clusterbuster-master> yarn start
yarn run v1.22.4
$ yarn build && ts-node example/express.ts
$ rollup --config rollup.config.js
./lib/index.ts → dist/index.d.ts...
created dist/index.d.ts in 5.7s
./lib/index.ts → dist/index.js...
created dist/index.js in 5.1s
attempting to create supporting sql functions
failure in creating First sql function
failure in creating TileBBox sql function
failure in creating TileDoubleBBox sql function
Example app listening on port 3005!
send3663284b-0e58-4587-af82-b35604a99303: 4.964ms
3663284b-0e58-4587-af82-b35604a99303: 817.819ms
sendd0bdd671-1f47-4b40-84ba-2fed6adfd045: 3.451ms
d0bdd671-1f47-4b40-84ba-2fed6adfd045: 1276.588ms
sendcd36f672-4c4b-4a95-b772-7584e6eb8c55: 1.349ms
cd36f672-4c4b-4a95-b772-7584e6eb8c55: 1754.146ms
请求似乎正常,返回状态200,但是来自ClusterBuster服务器的图块数据未定义,地图上没有任何内容(无论您的MapBox还是我的Google Maps)。 同样,很好奇的是,所有瓦片响应似乎都具有相同的大小216B。
数据已正确导入到PostGIS数据库中。
使用VSCode Javascript调试终端调试undefined
服务器文件并使用命令express.ts
启动它后,结果为ts-node .\example\express.ts
。
在Chrome网络标签中,“预览”或“响应”子标签中都没有任何数据。
我还尝试在成功功能中将结果图块记录在快递服务器中,
server({
...//excluded for visibility
}).then(result => {
...//excluded for visibility
console.log(result)
res.status(200).send(result);
})
,下面是输出,我得到undefined
:
任何帮助或建议都非常感谢!预先谢谢你!
解决方法
在TileServer配置(使用import pygame
from PIL import ImageGrab
class Player():
def __init__(self,img,x,y,window):
self.fist = img
self.pos = (x - 80,y + 40)
self.win = window
def move(self,movespeed,pressed):
# here we maintain the players position with self.pos
# this allows you to have multiple instances
# with different positions
x,y = self.pos
if pressed[pygame.K_a]:
x -= movespeed
elif pressed[pygame.K_d]:
x += movespeed
elif pressed[pygame.K_w]:
y -= movespeed
elif pressed[pygame.K_s]:
y += movespeed
self.pos = (x,y)
def display(self):
self.win.blit(self.fist,self.pos)
pygame.init()
screenshot = ImageGrab.grab()
WIDTH,HEIGHT = screenshot.size
RESOLUTION = (WIDTH,HEIGHT)
BACKGROUND_COLOR = (79,205,109)
MOVESPEED = 5
window = pygame.display.set_mode(RESOLUTION,flags=pygame.RESIZABLE,depth=32)
pygame.display.set_caption("The Connection")
clock = pygame.time.Clock()
# this is whatever your image is
img = pygame.image.load('fist.png')
x = int(WIDTH / 2 - 470)
y = int(HEIGHT / 2 - 400)
main_player = Player(img=img,x=x,y=y,window=window)
running = True
while running:
pressed = pygame.key.get_pressed()
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
main_player.move(movespeed=MOVESPEED,pressed=pressed)
window.fill(BACKGROUND_COLOR)
main_player.display()
pygame.display.flip()
clock.tick(60)
)中启用调试后,我注意到2个错误:
<?php
if (! function_exists('imap_open')) {
echo "IMAP is not configured.";
exit();
} else {
?>
<div id="listData" class="list-form-container">
<?php
/* Connecting Gmail server with IMAP */
$connection = imap_open('{imap.gmail.com:993/imap/ssl}INBOX','gmail username','password') or die('Cannot connect to Gmail: ' . imap_last_error());
/* Search Emails having the specified keyword in the email subject */
$emailData = imap_search($connection,'SUBJECT "Article "');
if (! empty($emailData)) {
?>
<table>
<?php
foreach ($emailData as $emailIdent) {
$overview = imap_fetch_overview($connection,$emailIdent,0);
$message = imap_fetchbody($connection,'1.1');
$messageExcerpt = substr($message,150);
$partialMessage = trim(quoted_printable_decode($messageExcerpt));
$date = date("d F,Y",strtotime($overview[0]->date));
?>
<tr>
<td style="width:15%;"><span class="column"><?php echo $overview[0]->from; ?></span></td>
<td class="content-div"><span class="column"><?php echo $overview[0]->subject; ?> - <?php echo $partialMessage; ?></span><span class="date"><?php echo $date; ?></span></td>
</tr>
<?php
} // End foreach
?>
</table>
<?php
} // end if
imap_close($connection);
}
?>
debug: true
最初,我是使用SELECT ST_AsMVT(tile,'points',4096,'geom') AS mvt FROM tile
{
e: error: password authentication failed for user "userXYZ"
...
或SELECT ST_AsMVT(tile,'geom') AS mvt FROM tile
{
e: Error: read ECONNRESET
at TCP.onStreamRead (internal/stream_base_commons.js:205:27) {
...
从clusterbuster的根目录运行的(下面使用相同的名称,并尝试与我的用户而不是ts-node .\example\express.ts
配置文件进行连接)>
从yarn start
文件夹运行.env
后,它考虑到ts-node express.ts
用户(而不是我的用户)的example
配置文件。现在,从服务器返回的切片数据正常,该示例按预期工作。
非常感谢cosmin-petrescu的贡献者对我的帮助。 整个线程可见here on github。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。