BookmarkSubscribeRSS Feed
Reeza
Super User

Statistics Canada has released the files for the new census boundaries and I'm trying to create a map for Alberta.

The data they provide is for all of Canada, so if I map all of Canada the map appears correct, but if I map only Alberta it's rotated. I'd like to rotate it a centered version, more similar to what you'd see in Google Maps - with the top boundary parallel to the top of the page. 

 

Is there a straightforward option to do this? GPROJECT? My Google/Search is failing me today 😞

 

I've attached a data step version to create the file required for mapping, in a text file (zipped because it was too big otherwise) and the code to create the map is below.

Other features that would be nice, that I'll work on next:

  • Create HTML where a mouse hover shows CSD name and population (from DATA table)
  • Full AB boundaries, even if no information is present. 
proc gmap map=alberta_CSD2016;
   id csdname  ;
choro csdname; 
run; 
quit; 

 

 

 

 

1 REPLY 1
Darrell_sas
SAS Employee

Looking at the data in your map data set, it appears to be projected.

It is a similar projection to our MAPSGFK.CANADA data set.  If you do all of Canada it is on the same angle as when you display Alberta only.  You need to find what projection it is in to "unproject" it with Proc GPROJECT and the PROJ4 options (From= and To=).

Here is the code:

data alberta;  set mapsgfk.canada; 
  /*Uncomment for UNPROJECTED*/ /*x=long; y=lat;*/ 
  if id1="CA-48" then output; run;
proc gmap map=alberta data=alberta; id id; choro id; run;

Here is MAPSGFK.CANADA projected and unprojected:

 

projected.PNGunprojected.PNG

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 881 views
  • 0 likes
  • 2 in conversation