Qgis2threejs
Qgis2threejs copied to clipboard
Serve the 3D map with Django
Hi! I've used this plugin with the 2.18 QGIS version, then the previous version of qgis2threejs. With that version was very simply to serve the 3D map on a Django site becouse the only thing that I does was insert a Django static file tag inside the html script tag. For example something like this {% static 'my_path/index.js' %}
With the new version there isn't index.js but there is the directory "index" and the new core of the 3D map is scene.json. If I change the path of the files called from scene.json I see in console 404 error related to a0.json, b0.bin and b0.png.
What do you suggest for solve this problem?
I'm trying to put the code of scene.json instead of its path
// load the scene
app.loadJSONFile(
{"type": "scene", "properties": {"height": 90.1010101010101, "width": 100.0, "baseExtent": [725282.3732700318, 6006086.588087205, 727901.7482727035, 6008446.671422945], "crs": "EPSG:3857", "proj": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs", "rotation": 0, "wgs84Center": {"lat": 47.39790958284822, "lon": 6.527087535108197}, "zExaggeration": 1.0, "zShift": 0.0}, "layers": [{"type": "layer", "id": 0, "properties": {"name": "clip_dtm_francia_eudem", "queryable": 1, "visible": true, "type": "dem", "shading": true}, "data": [{"type": "block", "layer": 0, "block": 0, "grid": {"width": 211, "height": 190, "url": "./data/index/a0.bin"}, "width": 100.0, "height": 90.1010101010101, "translate": [0.0, 0.0, 0.0], "zShift": 0.0, "zScale": 0.038177046012121664, "material": {"type": 0, "image": {"url": "./data/index/a0.png"}, "ds": 1}, "sides": true}]}]},
function () {
app.start();
// North arrow inset
if (Q3D.Config.northArrow.visible) app.buildNorthArrow(document.getElementById("northarrow"), app.scene.userData.rotation);
}
);
When I do this the 3D become blank but inside Developers tool of Chrome there isn't any errors. Now I'm working on the default product of your plugin, without DJango.
How I can solve this problem?
@MaxDragonheart in that case, use app.loadJSONObject
instead of app.loadJSONFile
.
Thank you :)
I think this can be closed, problem was solved :)