Geolicious / qgis2leaf

A QGIS plugin to create a working leaflet based webmap from it
127 stars 30 forks source link

JS for numeric field name #117

Closed sabas closed 9 years ago

sabas commented 9 years ago

When exporting, there should be a check for numeric field names. I exported a shape where a field was named '23' and the resulting code in the popup function was

+ '</td></tr><tr><th scope="row">23</th><td>' + Autolinker.link(String(feature.properties.23)) +

It should be

+ '</td></tr><tr><th scope="row">23</th><td>' + Autolinker.link(String(feature.properties['23'])) +

otherwise will fail (no numeric variable names are allowed)

tomchadwin commented 9 years ago

I think we can change the pop-up code to your second syntax, but an underlying problem (am I right, @ricckli) is that the dot notation syntax is used in the QGIS JSON export function. Unless that is changed, we can't completely solve this issue of column names which are invalid JS property/variable names.