在示例示例中,如何从ClusterBuster矢量切片服务器接收切片数据?

问题描述

摘要

似乎这些家伙在ClusterBuster矢量切片服务器上的内置过滤,群集和缓存方面做得很棒。 我对这个看起来非常有前途的项目感到非常兴奋,我很想尝试一下!

我正在一个项目中,通过矢量图块服务器通过Deck.gl在Google Maps上绘制MVTLayer层(integration)。 我想尝试整合并从ClusterBuster服务器提供一些保存在PostGIS中的聚集点。

预期结果:

实际结果:

  • 提供的示例示例不起作用(点未显示在地图上,MapBox或带有Deck.gl的Google地图上)。

我的尝试

我尝试构建并运行提供的示例,但是以某种方式,我无法做到这一点。

我运行了提供的快递服务器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。

_img

数据已正确导入到PostGIS数据库中。

_img2

使用VSCode Javascript调试终端调试undefined服务器文件并使用命令express.ts启动它后,结果为ts-node .\example\express.ts

在Chrome网络标签中,“预览”或“响应”子标签中都没有任何数据。

_img  1-2

我还尝试在成功功能中将结果图块记录在快递服务器中,

server({ 
   ...//excluded for visibility 
}).then(result => {
   ...//excluded for visibility 

   console.log(result)

   res.status(200).send(result);
})

,下面是输出,我得到undefined

enter image description here

任何帮助或建议都非常感谢!预先谢谢你!

解决方法

在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

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...