I am trying to read from a Web Map Server w/out using the mapping toolbox (more specifically, w/out using the WebMapServer object). I can construct the URL myself w/out problem and can just use imread for WMSs that return bmp files. However, one of the WMSs returns BIL files (Band InterLeaved) and imread() does not recognize it.
How can I read a BIL file from a URL w/out using the mapping toolbox?
Edit: Here is an example URL that I’d like to read:
Also, if I try to just grab the byte data w/ urlread and then write it to file, somehow some of the values are lost.
bytedata = urlread( mapurl );
fp = fopen( 'tmp.bil', 'w' );
fwrite( fp, bytedata, 'uint8' );
fclose( fp );
fp = fopen( 'tmp.bil', 'r' );
z = fread( fp, 'int16' );
imagesc( reshape( z, 925, 1113 )' );
The above displays an image similar to that returned by the mapping toolbox but there are regions that are set to a constant value that should not be.
The solution to the above problem is to use urlwrite() rather than urlread(), since the latter will not properly handle binary data.