I don't know what that QGIS plugin expects, but have you looked at the GeoJSON writer? Could that be it?
Hi @pascatl
The QGIS plugin expects a .js file with the GeoJSON feature(s) assigned to a variable. This .js file is included as a script in the output .html, which calls the variable and adds it to the map. (You can verify this in your qgis2web output folder in /data.) The fact that the .html uses a .js file with the GeoJSON assigned to a variable isn't necessary for the web app to work.
It might be possible to create this kind of .js file with FME, but since we don't have a "Javascript" writer, it might be a bit of a hack. Instead I would suggest writing out your GeoJSON to a .json file with FME, and consuming that in your application.
Hope this helps!
Nathan
Hi @pascatl
The QGIS plugin expects a .js file with the GeoJSON feature(s) assigned to a variable. This .js file is included as a script in the output .html, which calls the variable and adds it to the map. (You can verify this in your qgis2web output folder in /data.) The fact that the .html uses a .js file with the GeoJSON assigned to a variable isn't necessary for the web app to work.
It might be possible to create this kind of .js file with FME, but since we don't have a "Javascript" writer, it might be a bit of a hack. Instead I would suggest writing out your GeoJSON to a .json file with FME, and consuming that in your application.
Hope this helps!
Nathan
Thank you, I will give it a try and let you know, if it works for me.
Hi @pascatl
The QGIS plugin expects a .js file with the GeoJSON feature(s) assigned to a variable. This .js file is included as a script in the output .html, which calls the variable and adds it to the map. (You can verify this in your qgis2web output folder in /data.) The fact that the .html uses a .js file with the GeoJSON assigned to a variable isn't necessary for the web app to work.
It might be possible to create this kind of .js file with FME, but since we don't have a "Javascript" writer, it might be a bit of a hack. Instead I would suggest writing out your GeoJSON to a .json file with FME, and consuming that in your application.
Hope this helps!
Nathan
The solution was, as you mentioned, to export the new spatial data as GeoJSON and assigning the GeoJSON to a variable in my javascript file using ajax. Instead of using the converted .js, I can now replace new data easily with GeoJSONs.
var geojson_data = JSON.parse($.ajax({'url': 'data/data.geojson', 'async': false}).responseText);
"geojson_data" is the "new" .js file linked in the javascript code.
Thank you for your help.
The solution was, as you mentioned, to export the new spatial data as GeoJSON and assigning the GeoJSON to a variable in my javascript file using ajax. Instead of using the converted .js, I can now replace new data easily with GeoJSONs.
var geojson_data = JSON.parse($.ajax({'url': 'data/data.geojson', 'async': false}).responseText);
"geojson_data" is the "new" .js file linked in the javascript code.
Thank you for your help.
Awesome, thanks for sharing! I used this (QGIS2Web) a lot on a previous project (QGIS 2.x era). Especially for sharing a 3D view of contours to CAD specialists. Very useful!
Edit: I used QGIS2ThreeJS. Different plugin, 3D vs 2D, but same principle.