Closed zyxgis closed 1 month ago
The RTTPicker
is deprecated in favor of the newer ObjectIDPicker
.
There's an example of how to use it in the Picker imgui panel here:
https://github.com/gwaldron/osgearth/blob/master/src/osgEarthImGui/PickerGUI
You will also need to enable feature indexing on your layer for picking to work. You can call
featureModelLayer->options().featureIndexing()->enabled() = true;
before opening the layer or adding it to the Map. Good luck!
@gwaldron thank you for your reply
i try to run osgearth_imguid,
osgearth_imguid.exe D:\data\osm.earth
and use Picker tool , but it cann't pick feature
the content of my earth file is :
<map name="Worldwide OSM feature data">
<options>
</options>
<XYZImage name="OSM Imagery">
<url>https://[abc].tile.geofabrik.de/549e80f319af070f8ea8d0f149a149c2/{z}/{x}/{y}.png</url>
<profile>spherical-mercator</profile>
<cache_policy usage="read_write"/>
<attribution>©OpenStreetMap contributors</attribution>
</XYZImage>
<OGRFeatures name="world-data">
<url>E:/data/world.shp</url>
</OGRFeatures>
<!--
<FeatureImage name="Countries" opacity="0.75">
<features>world-data</features>
<styles>
<style type="text/css">
default {
fill: #ff7700;
stroke: #ffff00;
stroke-width: 5km;
}
</style>
</styles>
</FeatureImage>
-->
<FeatureModel name="Country boundaries" features="world-data" feature_indexing="true">
<!--<layout tile_size="500000" crop_features="true" paged="true">
<level max_range="1e10"/>
</layout>-->
<styles>
<style type="text/css">
world {
fill: #ff7700;
stroke: #ffff00;
stroke-width: 3px;
stroke-tessellation-size: 1km;
render-lighting: false;
altitude-clamping: terrain-drape;
}
</style>
</styles>
</FeatureModel>
<!--
<TMSElevation name="ReadyMap 90m Elevation">
<url>http://readymap.org/readymap/tiles/1.0.0/116/</url>
</TMSElevation>
-->
</map>
Replace feature_indexing="true"
with pickable="true"
.
This is shorthand for
<feature_indexing enabled="true"/>
Good luck.
@gwaldron thank you very much. it is ok.
i use vcpkg toolchain to compile osgearth
this is my osgearth's version infos:
osgearth_versiond.exe --caps [osgearth info] Hello, world. [osgearth info] [Capabilities] osgEarth Version: 3.6.0 build 158 [osgearth info] [Capabilities] GDAL Version: 3.9.0 [osgearth info] [Capabilities] OSG Version: 3.6.5 [osgearth info] [Capabilities] OSG GL3 Features: yes [osgearth info] [Capabilities] OSG FFP Available: no [osgearth info] [Capabilities] CPU Cores: 12 [osgearth info] [Capabilities] GL_VENDOR: Intel [osgearth info] [Capabilities] GL_RENDERER: Intel(R) UHD Graphics 630 [osgearth info] [Capabilities] GL_VERSION: 3.3.0 - Build 31.0.101.2127 [osgearth info] [Capabilities] GL CORE Profile: yes [osgearth info] Goodbye.
my code is from "osgearth_featurequery.cpp", the code is: