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