How do I generate a Hammer projection from my PNG image file using Mapping Toolbox 2.6 (R2007b)?
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
MathWorks Support Team
le 27 Juin 2009
Modifié(e) : cui,xingxing
le 3 Juin 2024
I want to produce a map of a planet using the Hammer-Aitoff Projection. The example in the documentation for GEOSHOW produces a Hammer projection of the Earth using the shapes of the continents. However, there is nothing equivalent to oceans and continents for other planets so I cannot use contours of shapes.
Réponse acceptée
MathWorks Support Team
le 27 Juin 2009
If you have a PGW worldfile accompanying the PNG file, that will you to create a proper Hammer projection of the PNG image.
If you do not have a worldfile, then you can create a referencing matrix using the function MAKEREFMAT. Once you have a referencing matrix, you can read the data from the PNG file using IMREAD and use the image syntax for GEOSHOW.
For example, if the image covered the entire Earth and each pixel covered a one-degree-by-one-degree square, and the upper left corner of the image is at -180 degrees longitude and 90 degrees latitude, then:
lat11 = 89.5; % Cell-center latitude corresponding to image(1,1)
lon11 = -179.5; % Cell-center longitude corresponding to image(1,1)
dLat = -1; % From row to row moving south by one degree
dLon = 1; % From column to column moving east by one degree
R = makerefmat(lon11, lat11, dLon, dLat)
X = imread('myImage.png');
figure;
axesm ('hammer', 'Frame', 'on', 'Grid', 'on');
geoshow(X,R)
0 commentaires
Plus de réponses (1)
cui,xingxing
le 3 Juin 2024
Modifié(e) : cui,xingxing
le 3 Juin 2024
latlim = [-90 90];
lonlim = [-180 180];
rasterSize = [180 360];
R = georefcells(latlim,lonlim,rasterSize,'ColumnsStartFrom','north');
X =checkerboard(80,3,6);
X = imresize(X,rasterSize);
figure;
tiledlayout(2,1);
% origin
nexttile;
imshow(X);
title("origin image")
% hammer projection
nexttile;
axesm ('hammer', 'Frame', 'on', 'Grid', 'on');
geoshow(X,R)
title("hammer image")
0 commentaires
Voir également
Catégories
En savoir plus sur Map Display dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!