Listing buildings' thematic data with 3D Web Map Client

102 Views Asked by At

I'm using 3D Importer/Export to import a .gml file to a Postgres 3D CityDB.

Now I want to visualize the buildings on the map and list their characteristics. I've managed to visualize them, but as far as the characteristics go, I'm having some trouble. I'm using PostgREST for serving the thematic data. The issue I've encountered and can't seem to find a solution to is that the 3D CityDB has information about a building spanning multiple tables but 3DWMC queries only one table. When clicking a table, 3DWMC executes a request to the URL that I've specified + ?gmlid={the id of the building I've clicked}. The only table that seems to have a gmlid field is cityobject.

Here is the configuration of 3DWMP I have:

enter image description here

The URL is http://localhost:8000/exports/export7/export.kml and the cityobjectsJsonUrl is http://localhost:8000/exports/export7/export.json.

And here is the information that is displayed when clicked:

enter image description here

In a nutshell, I want to display the address of a building (for example) when clicked.

1

There are 1 best solutions below

0
On BEST ANSWER

Well, I eventually figured it out.

You have to create a materialized view and the query against it.

Here is the view named view_attributes (credit goes to this issue):

SELECT cityobject.gmlid,
    concat('address '::text, row_number() OVER (PARTITION BY address_to_building.building_id)) AS attribute,
    concat(address.street::character varying(255), ' ', address.house_number::character varying(255), ', ', address.zip_code::character varying(255), ', ', address.city::character varying(255), ', ', address.country::character varying(255)) AS value,
    0 AS order_vba
   FROM cityobject,
    building
     JOIN address_to_building ON building.id = address_to_building.building_id
     JOIN address ON address.id = address_to_building.address_id
 WHERE cityobject.id = building.id

And then changed the thematicDataUrl in the UI to: http://localhost:3000/view_attribute.