- Load the kml file. This will be your boundary.
- Load the geotiff file. Make the necessary spatial coordinates using meshgrid
- Using the boundary and data/ raster from geotiff; use inpolygon to get the coordinates inside your boundary.
- From the extracted indices using inpolygon, make your required raster.
- Use contour to plot the contour lines.
- Convert contour to kml using: https://in.mathworks.com/matlabcentral/fileexchange/33800-kml-contour-plot
Terrain Elevation Data (Contour - Level Curve)
9 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi, I'm new to the mapping toolbox and I would like to get the contour data for a given locale.
Here's an example image:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1092725/image.jpeg)
I would like to export the curves to kml, so that I can open them in google earth.
I'm using a GeoTIFF file that contains the terrain data and a kml file containing the boundary of the area of interest.
Below is an image of the GeoTIFF file loaded on the desktop and an image of the boundary in the kml file, respectively.
GeoTIFF:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1092730/image.jpeg)
KML:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1092735/image.jpeg)
Below is the code used to load the files:
clc, clear, close all;
kml = kml2struct("Marcador sem título.kml");
Long = kml.Lon;
Lati = kml.Lat;
%geoplot(Lati,Long)
%geobasemap streets
[A,R]=readgeoraster("s17_w048_1arc_v3.tif",'OutputType','double');
latlim = R.LatitudeLimits;
lonlim = R.LongitudeLimits;
usamap(latlim,lonlim)
geoshow(A,R,'DisplayType','surface')
demcmap(A)
It is worth noting that the KML boundary is within the geographic location to which the GeoTIFF file belongs.
0 Kommentare
Antworten (1)
KSSV
am 10 Aug. 2022
2 Kommentare
Siehe auch
Kategorien
Mehr zu Map Display finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!