I'm not understanding how to get a reference from a .jpg file

I have the following code: % read colorado tif file % Pathname = 'C:\Users\chammerschmidt\Documents\Projects\TerrainData\CombineBoulder_N39_N40_W106\'; Filename = 'N39_N40_W106_LatLong.jpg'; cd(Pathname) % states = geoshape(shaperead('usastatehi','UseGeoCoords',true)); stateName = 'Colorado'; co = states(strcmp(states.Name, stateName)); latlim = [min(co.Latitude),max(co.Latitude)]; lonlim = [min(co.Longitude),max(co.Longitude)]; [latlim, lonlim] = bufgeoquad(latlim,lonlim, 0.05, 0.05); % RGB = imread(Filename); WorldFileName = getworldfilename(Filename); R = worldfileread(WorldFileName,'geographic',size(RGB)); % figure(1) ax = usamap(latlim,lonlim); oceanColor = [0.5 0.7 0.9]; setm(ax,'FFaceColor',oceanColor) geoshow(states) geoshow(co, 'LineWidth',1.5,'FaceColor',[0.5 0.8 0.6]) geoshow(Filename,'DisplayType','image'); % disp('the end') And I am getting the error 'Error using internal.map.checkfilename>checkDiskfilename (line 172) Function WORLDFILEREAD was unable to find file 'N39_N40_W106_LatLong.jgw'.
Error in internal.map.checkfilename (line 55) [fullfilename, fid]=checkDiskfilename(filename, ext, function_name);
Error in worldfileread (line 50) worldFileName = internal.map.checkfilename(worldFileName, {}, mfilename, 1, false);
Error in ReadColoradoTiffile (line 16) R = worldfileread(WorldFileName,'geographic',size(RGB));'
And I don't understand how to get R. Chriss

댓글 수: 1

Please edit your question and use the text formatting tools that are above the text box. There is one specifically marked "code", and using this (together with the preview pane underneath the text box) makes our lives a lots easier, as then we can actually read your code... it increases the chances of you getting the right answer to your problem!

댓글을 달려면 로그인하십시오.

답변 (2개)

Chad Greene
Chad Greene 2014년 11월 24일
Agh, it's tough to read proportionally-spaced code. I see an inconsistency in the file names you're calling. You've defined,
Filename = 'N39_N40_W106_LatLong.jpg';
however, the worldfileread function is trying to call a file called 'N39_N40_W106_LatLong.jgw'. Is that file extension a typo?

댓글 수: 2

I use the getworldfilename to change the extension to the .jpw. I guess I am not understanding. I could send you the code and the file so that it would be easier to read and debug if you would like. Chriss
Sorry, I don't know much about worldfiles. Hopefully someone else on the forum can help.

댓글을 달려면 로그인하십시오.

Chriss Hammerschmidt
Chriss Hammerschmidt 2014년 11월 24일

0 개 추천

I use the getworldfilename to change the extension to the .jpw. I guess I am not understanding. I could send you the code and the file so that it would be easier to read and debug if you would like. Chriss

카테고리

도움말 센터File Exchange에서 MATLAB에 대해 자세히 알아보기

질문:

2014년 11월 24일

댓글:

2014년 11월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by