Hello,
I am creating a map of Europe. Maps are projected in a way that northern hemisphere countries like Denmark, Sweden etc. are displayed bigger and the central Europe dense and smaller.
Instead, I'd like flat display (as in square map and not as in globe).
I have tried to change from Albers to other different types of projections but doesn't seem to work.
Will appreciate your tips. Thank you.
"but doesn't seem to work"
Did you get a map or just error messages? Please show.
Are you starting with one of the SAS supplied maps?
If so, then show the entire procedure for the projection and your Gmap code. Then we can duplicate, hopefully, your result.
I would not be surprised if you have to trim out some of the outlying islands if using the MAPSGFK.Europe or similar. Any projection that maintains those is likely to be an issue.
I am using Eurostat provided shapefiles where id is statistical region (that I cannot attach due to size). However, writing my (non-reproduceable) code below.
My question is simple: In "proc gproject" project, have tried many options including albers, lambert, and other options that project the map in globe shape (see: https://documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.5&docsetId=grmapref&docsetTarget=p0o...)
Do you know any projection option/trick that project the map in square display? (I have already trimmed the unnecessary islands etc. from shape file). Thank you.
Code:
libname drive "C:\local";
proc gproject data=shapefile out=id dupok eastlong degrees project=albers;
id id;
run;
proc greduce data=shapefile out=shapefile;
id id;
run;
FILENAME drive "C:\local";
DEVICE=imgpng
xpixels=1000
ypixels=1000
transparency
GSFNAME=drive
GSFMODE=REPLACE
NOFILEONLY;
pattern1 c=cxeff3ff;
pattern2 c=cxbdd7e7;
pattern3 c=cx6baed6;
pattern4 c=cx3182bd;
pattern5 c=cx08519c;
ods _all_ close;
ods listing;
proc gmap data=value map=shapefile density=0 all;
id id;
choro bin/cdefault=white cempty=black;
label bin=value;
run;
quit;
ods listing close;
ods output;
Could you provide an example (image/screen-capture/etc) of a Europe map that you *do* like. Then we'll know what sort of projection/look you're striving for...
Basically, I think the ultimate answer will be in using Proc Gproject's to= option (which allows you to use any proj.4 projection), rather than using the project= (which only allows you to specify some of the more common projections by name).
The proj.4 projection strings can be a bit daunting, therefore SAS has placed several of them in the sashelp.proj4def dataset, where the 'name' column contains shortcut names you can use. I have gone through all the ones that have 'Europe' in the description field, and "ESRI:37201" appears to be the most 'square'. Here's some sample code showing how to use Gproject's to= option (you can specify a shortcut from the table, or a full proj.4 string):
data europe; set mapsgfk.europe (drop = x y);
run;
proc gproject data=europe out=europe latlong eastlong degrees
latmax=70.9 longmin=-12 to="ESRI:37201";
id id;
run;
proc gmap data=europe map=europe;
id id;
choro segment / levels=1 nolegend coutline=gray55;
run;
And here is the output from the above code:
Thank you for recreating this map here. It kind of provided me "square" map that I was looking for.
But now realizing (also confirmed from your map) that its possibly a problem of actual sizes of the country. (Inserted an example below where my values are categorized and in the countries like Germany, Belgium it's too dense.) I'd rather keep the entire map than clipping the parts. In case, you know quick fixing. Thanks a lot! For fast solutions.
You may also investigate the techniques for displaying disparate areas.
If you have Proc Gmap is suspect that you have the MAPS library and should be able to run this code.
proc gmap data=maps.us map= maps.us ; id statecode; choro statecode / nolegend; run;
The states of Alaska and Hawaii are not shown in their actual positions because there is a lot of ocean between Hawaii and the US main land and Alaska has Canada between it and the lower 48 states. Plus the size of Alaska is much larger than Texas, so the map has that bit reduced, and Hawaii has the islands enlarged, relative to the main scale of the map, because otherwise they would be pretty small.
So perhaps you could treat Scandinavia similar to Alaska: clip that part out make a slightly reduced scale version and then recombine with the rest of the Europe data but Scandinavia placed off set and smaller.
Not a trivial exercise, especially getting the relative X, Y coordinates offset in the reduced size to mate will with the rest of Europe but doable.
One of our mapping developers also provided the following suggestion:
"You could also point them to http://spatialreference.org to peruse other projections they may want to try. As long as it has EPSG or ESRI in the code, we should support it. https://spatialreference.org/ref/?search=europe"
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.