TerriaJS / terriajs

A library for building rich, web-based geospatial data platforms.
https://terria.io
Apache License 2.0
1.16k stars 361 forks source link

Making vector tile feature properties available to feature info templates #2612

Closed steve9164 closed 6 years ago

steve9164 commented 7 years ago

Feature info template for testing

#start={"version":"0.0.05","initSources":[
{
  "catalog": [
    {
      "name": "props-test",
      "type": "csv",
      "data": "sa4_code_2011,val,time\n101,2,2016-07-23\n102,3,2016-07-23\n101,4,2016-08-06\n102,5,2016-08-06",
      "featureInfoTemplate": {
        "name": "SA4 Code: {{SA4_CODE11}}",
        "template": "<h3>Property from CSV</h3><p>Value: <b>{{val}}</b></p><h3>Property from vector tile</h3><p>Area: <b>{{ALBERS_SQM}}</b></p>"
      },
      "isEnabled": true
    }
  ]
}
]}

TerriaJS branch vt_feature_info. This will work with any instance that uses vector tiles.

Problem

Using the above, properties available to feature info template are like this:

{
    "asset_name_from_vector_tiles": "something",
    "available_capacity_from_vt": "[{\"year\":2016,\"capacity\":55,\"load\":41.6,\"available_capacity\":13.4}]",
    "csv_data_attribute": 43.7
}

and I don't think mustache can access the nested stringified data.

Possible solutions:

Actual questions:

steve9164 commented 7 years ago

@kring I included you in this in case you have an opinion on either of the "Actual questions" I included at the end.

meh9 commented 7 years ago

For the Actual Question 2, yes I think we should expose all props.

kring commented 6 years ago

Fixed by #2696.