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 comentario

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!

Iniciar sesión para comentar.

Respuestas (2)

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 comentarios

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.

Iniciar sesión para comentar.

Chriss Hammerschmidt
Chriss Hammerschmidt el 24 de Nov. de 2014
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

Categorías

Más información sobre MATLAB en Centro de ayuda y File Exchange.

Productos

Preguntada:

el 24 de Nov. de 2014

Comentada:

el 25 de Nov. de 2014

Community Treasure Hunt

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

Start Hunting!

Translated by