How does matlab construct 3d buildings in siteviewer?
34 次查看(过去 30 天)
显示 更早的评论
I'm trying to utilize the ray tracing/propagation models in Matlab and would like to be able to make use of the geometries (footprints and heights) of the buildings that are rendered in siteviewer. Right now I'm using an external tool (osmium and pyrosm) to parse the .osm file I provide to the siteviewer 'buildings' parameter to extract this data. As far as I can tell, in the .osm file the only "height" information comes in the form of <height> and <building:levels> tags. The number of <ways> with these tags is not equal to the number of buildings that are generated in the siteviewer window. Is there any way to access the 3d geometries siteviewer creates?
0 个评论
回答(1 个)
Eswaramoorthy
2023-6-7
In MATLAB's Site Viewer, the 3D geometries of buildings are generated based on the data provided in the OpenStreetMap (OSM) file, but the geometries themselves are not directly accessible through the Site Viewer interface. However, you can extract the 3D geometries of buildings using the Mapping Toolbox in MATLAB. Here's a general approach:
1. Import the OSM file: Use the `shaperead` function from the Mapping Toolbox to import the OSM file and convert it into a geographic data structure.
data = shaperead('your_osm_file.osm');
2. Filter buildings: Iterate over the imported data and filter out the buildings based on the available attributes such as `<building>` or `<building:levels>`.
buildings = data(strcmp({data.highway},'building'));
3. Extract building footprints: Extract the 2D footprints of the buildings by accessing the coordinates of the building polygons.
footprints = vertcat(buildings(:).Lat, buildings(:).Lon);
4. Extract building heights: Extract the heights of the buildings from the available attributes such as `<height>` or `<building:levels>`.
heights = [buildings(:).height];
5. Generate 3D geometries: Use the footprints and heights to generate 3D geometries of the buildings using the extrusion operation.
extrudedGeometries = extrude(buildings(:).Lon, buildings(:).Lat, heights);
Now you have access to the 3D geometries of the buildings in MATLAB, which you can further utilize for ray tracing or propagation modeling purposes.
Note that the `extrude` function mentioned above is not a built-in function in MATLAB, but you can implement it using various approaches such as creating a custom function or utilizing existing functions/libraries like the Extrude Polygons from the MATLAB File Exchange.
Keep in mind that the accuracy and availability of the building heights may vary depending on the information provided in the OSM file. It's recommended to inspect and validate the data to ensure its suitability for your specific use case.
Hope this helps!
7 个评论
Jacob Halbrooks
2023-10-13
This capability is available as of R2023b. In particular, Mapping Toolbox can read OSM files using readgeotable, and you just read in buildings data by specifying the Layer name-value argument as "buildings" or "buildingparts". You can inspect and edit the buildings data, including changing geometries or setting per-building materials. The data can be passed to Site Viewer for 3-D visualization and ray tracing analysis. The material names in the buildings data will be matched to the RF Propagation materials and used in the ray tracing analysis.
A complete example of the workflow is available here:
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Propagation and Channel Models 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!