- shaperead - https://www.mathworks.com/help/map/ref/shaperead.html
- overlay layers to web maps - https://www.mathworks.com/help/map/adding-overlay-layers-to-a-web-map.html
Plot shapefile over site location data
    18 ビュー (過去 30 日間)
  
       古いコメントを表示
    
Hi 
I want to plot site data on a map, then overlay a shape file (Polygons) over the sites such that the sites remain transperant. 
The following code tries to do that, but plots only the sites without the shape file ploygons
Any ideas please to plot it right? 
Combined_Authorities.shp file is include in the zip file.
The final plot may look like this: 

T2=readtable('Site_data_PS_Only.xlsx','Sheet',1);
T2.Sector = categorical(T2.Sector);
figure 
gb = geobubble(T2,'Lat','Long', ...
        'SizeVariable','Emissions','ColorVariable','Sector');
 gb.BubbleColorList = [255 0 0 %cement
    255 215 0 %F&D
    0 128 0   %Glass
    0 255 255 %Lime
   100 149 237 %NFR
    0 0 255    %Other chemicals
   138 43 226  %Other minerals
 255 20 147 %Other industry
    128 128 128 %Paper
    210 180 140 %Ref
    139 69 19    %Veh
    0 0 0  ]/255 ;
geobasemap streets
% geolimits([50.10319 61.15456],[-7.64133 1.75159])
S = shaperead('Combined_Authorities.shp','UseGeoCoords',true);
mapshow(S)
% geoshow(S,'facecolor', 'none')
0 件のコメント
回答 (1 件)
  Ishu
      
 2023 年 10 月 30 日
        Hi Ahmed,
I understand that you are tring to overlay ploygons over the sites using "shaperead()" and "mapshow()".
I tried to plot it at my end but i was getting an error because "Combined_Authorities.shx" and "Combined_Authorities.dbf" were not present at the same directory as of "Combined_Authorities.shp". 
I unzipped your "Combined_Authorities.zip" folder and in this folder only the "Combined_Authorities.shp" folder was present. When using the "shaperead" function, you only need to provide the path and filename of the ".shp" file as the input and MATLAB will automatically look for the associated files (such as the ".shx" and ".dbf" files) in the same directory and read the shapefile data accordingly.
But as ".shx" and ".dbf" were not present so you was getting errors and was not able to overlay polygons over the sites.
You can refer these documentation for more information:
You can also refer to this MATLAB Answer for more understanding:
Hope it helps.
0 件のコメント
参考
カテゴリ
				Help Center および File Exchange で Map Display についてさらに検索
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

