bchapuis commented on PR #812:
URL: 
https://github.com/apache/incubator-baremaps/pull/812#issuecomment-1849107005

   This is great, thanks a lot! I have been able to reproduce the issue and I 
can also confirm  that the new PostgresTileStore works properly with sql join 
queries.
   
   ![Screenshot 2023-12-10 at 23 20 
27](https://github.com/apache/incubator-baremaps/assets/238747/b8c1ae8b-ab08-4c72-a76e-02abd9b0dbfe)
   
   Regarding the PR, it would be great if you could rework the directory 
structure a bit. The other examples try to avoid using Docker files and extra 
HTML/CSS/JS files. The overall idea is to run and check most of the examples 
with a fresh build before releasing.
   
   Therefore, I suggest we only keep the following files to demonstrate that 
join queries are working:
   
   - postgresql-join/
     - init.sql
     - style.json
     - tileset.json
     - workflow.json
   
   In the init.sql file, the `INSERT INTO` statement should probably reproject 
the point from EPSG:4326 to EPSG:3857. It would also be nice to add a `DROP 
SCHEMA` stamement at the begining of the file to reset everything.
   
   The style.json and tileset.json files should probably reference a PostGIS 
database on localhost and assume that Baremaps serves tiles on 
http://localhost:9000/.
   
   I believe the query in the tileset.json file should be modified slightly due 
to an ambiguity on the id column. Here is a version that worked for me:
   
   ```sql
   SELECT pt.id::integer as id, jsonb_build_object('type', tt.type, 'size', 
pt.size) as tags, pt.geom as geom FROM baremaps.point_trees pt JOIN 
baremaps.tree_type tt ON pt.tree_type_id = tt.id
   ```
   
   A workflow.json file could execute the init.sql script, as shown below:
   
   ```json
   {
     "steps": [
       {
         "id": "postgresql-join",
         "needs": [],
         "tasks": [
           {
             "type": "ExecuteSqlScript",
             "file": "initdb/init.sql",
             "database": 
"jdbc:postgresql://localhost:5432/baremaps?&user=baremaps&password=baremaps"
           }
         ]
       }
     ]
   }
   ```
   
   Again, this a really cool use case, and I look forward to merge it. Do not 
hesitate to reach out if you have further questions.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to