Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

inverse map projections

22 views
Skip to first unread message

Zackary Johnson

unread,
Oct 11, 2008, 6:14:02 PM10/11/08
to
I have a projected image (image.shp), that I would like to convert into latitude and longitude for use with geoshow.m. I've tried projinv.m and minvtran.m to no avail. The readme.txt with the image file says,

------------------
The files are stored in the Robinson projection. The parameters are
Units meters
Spheroid sphere
Logitude of central meridian 0 0 0.000
false easting (metres) 0.00000
false northing (metres) 0.00000

Feature type: Polygon
Data Layers: (Shape File Name, Layer Title, and Layer Description)
------------------

The mstruct I'm using for both projinv and minvtran is:
------------------
mstruct =

mapprojection: 'robinson'
zone: []
angleunits: 'degrees'
aspect: 'normal'
falsenorthing: 0
falseeasting: 0
fixedorient: []
geoid: [1 0]
maplatlimit: [-90 90]
maplonlimit: [-180 180]
mapparallels: 38
nparallels: 0
origin: [0 0 0]
scalefactor: 1
trimlat: [-90 90]
trimlon: [-180 180]
frame: 'off'
ffill: 100
fedgecolor: [0 0 0]
ffacecolor: 'none'
flatlimit: [-90 90]
flinewidth: 2
flonlimit: [-180 180]
grid: 'off'
galtitude: Inf
gcolor: [0 0 0]
glinestyle: ':'
glinewidth: 0.5000
mlineexception: []
mlinefill: 100
mlinelimit: []
mlinelocation: 30
mlinevisible: 'on'
plineexception: []
plinefill: 100
plinelimit: []
plinelocation: 15
plinevisible: 'on'
fontangle: 'normal'
fontcolor: [0 0 0]
fontname: 'Helvetica'
fontsize: 10
fontunits: 'points'
fontweight: 'normal'
labelformat: 'compass'
labelrotation: 'off'
labelunits: 'degrees'
meridianlabel: 'off'
mlabellocation: 30
mlabelparallel: 90
mlabelround: 0
parallellabel: 'off'
plabellocation: 15
plabelmeridian: -180
plabelround: 0
------------------

What am I doing wrong? Or do I need more information?
Thanks in advance, Z

Rob Comer

unread,
Oct 12, 2008, 8:48:01 AM10/12/08
to
Your mstruct looks fine; it seems to match what you'd get from:

>> ax = axesm('robinson');
>> mstruct = getm(ax)

But because your filename ends in ".shp" and because the readme says "Polygon," I suspect that you actually have a polygon shapefile, not an image file. You could run SHAPEINFO on it for a quick confirmation.

In this case, you can import your polygons into a structure array (a "mapstruct") with Geometry 'Polygon' and X and Y coordinate fields, using SHAPEREAD. Then apply minvtran to the X and Y data of each element, and store the results back in another structure array that's identical to the first, but with Lat and Lon fields instead of X and Y fields (a "geostruct"). (In some cases, polygons that touch the edge of the map may need additional adjustment to close properly, etc.)

On the other hand, if you really have an image, then you need to resample it. The following demo should get you started:

<http://www.mathworks.com/products/demos/shipping/map/mapexunprojectdem.html?product=MG>

although it uses a DEM, which is similar to a one-band image. In the case of an RGB image, for example, you'd need to resample each band separately.

Rob Comer
Mapping Toolbox Development
The MathWorks, Inc.

0 new messages