COORDENADAS DE UN ARCHIVO SHAPEFILE

4 ビュー (過去 30 日間)
Carlos Escamilla León
Carlos Escamilla León 2024 年 3 月 28 日
回答済み: Avni Agrawal 2024 年 4 月 2 日
Hello community, I am trying to read the coordinates from a .shp file, however, I am getting an error that says it does not recognize the "Lat" variable that I read from my .shp
My question is, how can I fix it?
I hope someone can help me, I would greatly appreciate it.
  2 件のコメント
Dyuman Joshi
Dyuman Joshi 2024 年 3 月 28 日
How are you reading the shp file? Is the variable name correct?
Could you share the file? Use the paperclip button to attach.
Carlos Escamilla León
Carlos Escamilla León 2024 年 3 月 28 日
Yes, this is the file, I hope it can be downloaded, I'm new to this :(
Here is some of the code I made:
chiapas=shaperead('07ent.shp');
N = length(chiapas) ;
for i = 1:N
[chiapas(i).X ;chiapas(i).Y] ;
end
lim_long=[chiapas.X];
lim_lat=[chiapas.Y];
coor_inCh=inpolygon(longitud,latitud,lim_long,lim_lat);
lat_dentro=latitutes(coor_inCh);
long_dentro=longitudes(coor_inCh);
Also, it seems to me that I have an error with the variable "coor_inCh", but I don't know what it is :(

サインインしてコメントする。

採用された回答

Avni Agrawal
Avni Agrawal 2024 年 4 月 2 日
I understand that you are trying to read the co-ordinates from the above mentioned .shp file. To ensure the .shp file functions as expected, there are several important considerations to keep in mind.You might have encountered several warnings regarding missing .shx and .dbf files.
Regarding the .shx file warning:
  • The .shx file is an index file that accompanies the .shp file. MATLAB is warning you that it couldn't find this file. It's not critical for reading the shapefile since MATLAB can rebuild the index from the .shp file, but having the .shx file can speed up the reading process.
Regarding the .dbf file warning:
  • The .dbf file contains attribute data for each shape in the shapefile. The warning indicates that MATLAB couldn't find this file, so it will read the geometric data from the .shp file, but it won't be able to attach any attribute data to the shapes. Ensure that the .dbf file is in the same directory as the .shp file and that its name matches the .shp file name (except for the extension).
Note: Make sure that the .shp, .shx, and .dbf files for 07ent are all in the same directory and that they are accessible (not corrupted or locked by another program).
I hope this helps!

その他の回答 (0 件)

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by