boku-ilen / geodot-plugin

Godot plugin for loading geospatial data
GNU General Public License v3.0
109 stars 19 forks source link

Running demo project out of the box problem #30

Closed goatchurchprime closed 1 year ago

goatchurchprime commented 3 years ago

I am trying to build this on an Ubuntu 20.04 system following the instructions.

git clone https://github.com/boku-ilen/geodot-plugin.git cd geodot-plugin/ git submodule update --init --recursive

Submodule 'godot-cpp' (https://github.com/GodotNativeTools/godot-cpp) registered for path 'godot-cpp'
Cloning into '/home/julian/extrepositories/geodot-plugin/godot-cpp'...
Submodule path 'godot-cpp': checked out 'c9a740be34438ce999402b7b76304a38daaaa811'
Submodule 'godot_headers' (https://github.com/GodotNativeTools/godot_headers) registered for path 'godot-cpp/godot_headers'
Cloning into '/home/julian/extrepositories/geodot-plugin/godot-cpp/godot_headers'...
Submodule path 'godot-cpp/godot_headers': checked out 'ddf67cc7b8274c5fb77a71c828bab2991f1ee12a'

scons platform=linux generate_bindings=yes

cons: Reading SConscript files ...
note: scons_compiledb could not be imported. To be able to use the `--compiledb=` flag, please run `pip3 install scons-compiledb`.
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
g++ -o GeoRaster.os -c -std=c++17 -fPIC -I. -I/home/julian/extrepositories/geodot-plugin/src/global GeoRaster.cpp
g++ -o RasterTileExtractor.os -c -std=c++17 -fPIC -I. -I/home/julian/extrepositories/geodot-plugin/src/global RasterTileExtractor.cpp
g++ -o build/libRasterTileExtractor.so -shared GeoRaster.os RasterTileExtractor.os -lgdal
scons: done building targets.
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
g++ -o Feature.os -c -std=c++17 -fPIC -I. -I/home/julian/extrepositories/geodot-plugin/src/global Feature.cpp
g++ -o LineFeature.os -c -std=c++17 -fPIC -I. -I/home/julian/extrepositories/geodot-plugin/src/global LineFeature.cpp
g++ -o PointFeature.os -c -std=c++17 -fPIC -I. -I/home/julian/extrepositories/geodot-plugin/src/global PointFeature.cpp
g++ -o PolygonFeature.os -c -std=c++17 -fPIC -I. -I/home/julian/extrepositories/geodot-plugin/src/global PolygonFeature.cpp
g++ -o VectorExtractor.os -c -std=c++17 -fPIC -I. -I/home/julian/extrepositories/geodot-plugin/src/global VectorExtractor.cpp
VectorExtractor.cpp: In static member function 'static std::__cxx11::list<LineFeature*> VectorExtractor::crop_lines_to_square(const char*, double, double, double, int)':
VectorExtractor.cpp:205:32: warning: ignoring return value of 'OGRErr OGRLayer::CreateFeature(OGRFeature*)', declared with attribute warn_unused_result [-Wunused-result]
205 |     square_layer->CreateFeature(square_feature);
|     ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
g++ -o build/libVectorExtractor.so -shared Feature.os LineFeature.os PointFeature.os PolygonFeature.os VectorExtractor.os -lgdal
scons: done building targets.
scons: done reading SConscript files.
scons: Building targets ...
g++ -o src/gdlibrary.os -c -std=c++17 -fPIC -g3 -Og -fPIC -I. -Igodot-cpp/godot_headers -Igodot-cpp/include -Igodot-cpp/include/core -Igodot-cpp/include/gen -Isrc/raster-tile-extractor -Isrc/vector-extractor -Isrc -Isrc/global src/gdlibrary.cpp
In file included from godot-cpp/include/core/Godot.hpp:12,
from src/geodot.h:5,
from src/gdlibrary.cpp:1:
godot-cpp/include/core/Ref.hpp:5:10: fatal error: Reference.hpp: No such file or directory
5 | #include "Reference.hpp"
|          ^~~~~~~~~~~~~~~
compilation terminated.
scons: *** [src/gdlibrary.os] Error 1
scons: building terminated because of errors.
goatchurchprime commented 3 years ago

Okay, running it in the cpp directory (as per the instructions) did better.

Now I open the demo project and try to run, I got this:

image

goatchurchprime commented 3 years ago

Okay, so I missed the stage of running scons in the main directory. Perhaps it should be in the list of steps, because for someone trying to get it to work there's no difference between preparing to compile and compiling this.

Now when I run the demo I get this crash trace report:

handle_crash: Program crashed with signal 11
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[1] /lib/x86_64-linux-gnu/libc.so.6(+0x46210) [0x7fe6f3824210] (??:0)
[2] RasterTileExtractor::clip_dataset(GDALDataset*, double, double, double, int, int) (??:0)
[3] RasterTileExtractor::get_tile_from_dataset(GDALDataset*, double, double, double, int, int) (??:0)
[4] godot::GeoRasterLayer::get_image(double, double, double, int, int) (??:0)
[5] godot_variant godot::__wrapped_method<godot::GeoRasterLayer, godot::Ref<godot::GeoImage>, double, double, double, int, int>(void*, void*, void*, int, godot_variant**) (??:0)
[6] /home/julian/executables/Godot_v3.2.3-stable_x11.64() [0x2631dd7] (<artificial>:?)
[7] /home/julian/executables/Godot_v3.2.3-stable_x11.64() [0xc578ef] (??:?)
[8] /home/julian/executables/Godot_v3.2.3-stable_x11.64() [0xb40916] (??:?)
[9] /home/julian/executables/Godot_v3.2.3-stable_x11.64() [0x2a2337b] (<artificial>:?)
[10] /home/julian/executables/Godot_v3.2.3-stable_x11.64() [0x2a41760] (<artificial>:?)
[11] /home/julian/executables/Godot_v3.2.3-stable_x11.64() [0x18c8e4f] (??:?)
[12] /home/julian/executables/Godot_v3.2.3-stable_x11.64() [0x28ffdf6] (??:?)
[13] /home/julian/executables/Godot_v3.2.3-stable_x11.64() [0xbdee04] (??:?)
[14] /home/julian/executables/Godot_v3.2.3-stable_x11.64() [0x187e6de] (<artificial>:?)
[15] /home/julian/executables/Godot_v3.2.3-stable_x11.64() [0x18e66fe] (??:?)
[16] /home/julian/executables/Godot_v3.2.3-stable_x11.64() [0x298fdb0] (??:?)
[17] /home/julian/executables/Godot_v3.2.3-stable_x11.64() [0x85ce4d] (??:?)
[18] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3) [0x7fe6f38050b3] (??:0)
[19] /home/julian/executables/Godot_v3.2.3-stable_x11.64() [0x86b68e] (??:?)
-- END OF BACKTRACE --
goatchurchprime commented 3 years ago

Okay, we're on to the next problem. As per instructions I've downloaded 2Gig from https://www.data.gv.at/katalog/dataset/b5de6975-417b-4320-afdb-eb2a9e2a1dbf and unzipped it.

I've changed height_map_path_data and ortho_data_path to point to it.

Then I got the same error as above. This meant I had to find the correct coordinates. This required me to install qgis (another 0.5Gig) know how to run it, drag the tif file into it, point the cursor somewhere in the middle of the map to read off 493651,443824

So I've edited the two lines:

export(float) var start_position_webmercator_x = 493651.0 export(float) var start_position_webmercator_y = 443824.0

Now I've got this weird slowly wobbling red rectangle and a series of numbers being printed out.

image

What do I need to do now to get it to work like your demos in the talk?

kb173 commented 3 years ago

As I wrote in the Discord, this is just because you're using the heightmap as the texture, and the heights are all > 1 in the red channel, resulting in this all-red visualization. The "wobbling" is because the requested square moves every frame, so what you're seeing is a slow panning over the heights in your data.

Do #35 and #36 cover the problems you've encountered?

goatchurchprime commented 3 years ago

Okay, I've changed the mesh material shader to the following code:

shader_type spatial;

uniform sampler2D ortho: hint_albedo;
uniform sampler2D heightmap;

void vertex() {
    VERTEX.y = texture(heightmap, UV).r / 500.0;
}

void fragment() {
    //ALBEDO = texture(ortho, UV).rgb;
    float scaled_color = (texture(ortho, UV).r - 300.0) / 500.0;
    ALBEDO = vec3(scaled_color, scaled_color, scaled_color);    
}

Now I get a wobbling grey shaded image.

image

Where's the code you used for the demos in the talk where you could run around in VR?

goatchurchprime commented 3 years ago

Just tried compiling and running this out of the box again and set all the parameters to their defaults.

Problems are: heightmap_data_path and ortho_data_path don't have default values pointing to the data files.

And anyway it fails on the first line: var heightmap_data = Geodot.get_raster_layer(heightmap_data_path) with "Invalid call: Nonexistant function 'get_raster_layer' in base Node"

Any ideas what next?

kb173 commented 3 years ago

Actually they should have default values with valid paths (see https://github.com/boku-ilen/geodot-plugin/blob/master/demo/RasterDemo.tscn#L35)... did you pull and have no local changes?

That Invalid call: Nonexistant function 'get_raster_layer' in base Node" sounds like a compilation problem, which is strange since you already had it running. Did the compilation succeed?

kb173 commented 1 year ago

Closing since the new automated builds and pre-packaged demos hopefully make the setup process much easier.