Data visualization with SAS programming

GMAPs With Canada City Information

Reply
Contributor
Posts: 30

GMAPs With Canada City Information

Hi,

I'm a novice with GMAPs and I'm trying to create a Us/Canada chart with bars (values to be determined by the data) for particular cities in both US and Canada.  I'm finding the USCITY_ALL dataset in the MAPSGFK library works well for mapping to US cities.  Is there a similar map for Canadian cities?  ...Or is there another way to do it for Canada that I'm not aware of?

 

Thanks!

Super User
Posts: 22,823

Re: GMAPs With Canada City Information

Posted in reply to bendsteel6

What version of SAS do you have?

 

If you're 9.3+ I think you need to be using MAPSGSFK instead?

And you can download some custom files from here : http://support.sas.com/rnd/datavisualization/mapsonline/html/home.html

 

Contributor
Posts: 30

Re: GMAPs With Canada City Information

Hi,

I'm using the MAPSGSFK one.  Still didn't see a table that had the Canadian cities.  Is there one?

 

Thanks.

Super User
Posts: 22,823

Re: GMAPs With Canada City Information

Posted in reply to bendsteel6

Did you check the link? It has a sources that is available, one with city locations including 218 Canadian cities. I don't know if that would encompass your list of cities. You probably already know, but there are specific definitions for City/Town/Summer Village/Special Area etc. 

 

I don't know what you're trying to do, but Statistics Canada has a lot of SHP files available here:

http://www12.statcan.gc.ca/census-recensement/2011/geo/bound-limit/bound-limit-2016-eng.cfm

 

And depending on where you work, you may have access to a file called PCCF that maps postal codes to a latitude and longitude. 

 

If you're looking for basic lat/long for Canadian Cities you could probably wrangle one of the StatCan files into what you need. 

 

And SAS provides code/process if you purchase the lookup table from zipcodedownloads.com

 

Contributor
Posts: 30

Re: GMAPs With Canada City Information

Hi,

The link provided seems to point me to the MAPSGFK library, and to the WORLD_CITIES table.  This works for a lot of my data but I have many cities that don't show up in the WRLD_CITIES table, not sure why:

 

AJAX            ON
AYR             ON
DARTMOUTH       NS
DELTA           BC
DORVAL          QC
ETOBICOKE       ON
HANWELL         NB
LEVIS          QC
LIVELY          ON
MAIDSTONE       ON
MISSISSAUGA     ON
PEACERIVER      AB
SAINT-HYACINTHE QC
SAINT-PRIME     QC
SAINT-REMI      QC
SOUTHGLENGARRY  ON
STONEYCREEK     ON

Super User
Posts: 22,823

Re: GMAPs With Canada City Information

Posted in reply to bendsteel6

Not all of those are classified as Cities is one reason, some are towns or regional districts or components thereof. 

 

If you only have the few I'd probably just look them up on Google and add the coordinates in manually. 

Or, check the Open Data portals or here:

http://www.nrcan.gc.ca/earth-sciences/geography/topographic-information/free-data-geogratis/download...

 

 

Super User
Posts: 22,823

Re: GMAPs With Canada City Information

Posted in reply to bendsteel6
And it should be the WORLD_CITIES_ALL table, make sure it has the ALL.
Contributor
Posts: 30

Re: GMAPs With Canada City Information

Ahhhh....but alas, I'm only on 9.4.3.  It looks like WORLD_CITIES_ALL is only available to SAS 9.4.5.  Bummer!

 

Regarding the Open Data Portals link you sent, I wouldn't even know where to begin...I just want Canadian cities with lats and longs Smiley Sad

 

Thanks for your help!

Super User
Posts: 22,823

Re: GMAPs With Canada City Information

Posted in reply to bendsteel6

No, I have 9.4 M3 and found the ALL file online in the first link. 

 

It's long and slightly painful, but you can use PROC GEOCODE to derive them...there should be a simpler way.

http://support.sas.com/resources/papers/proceedings10/332-2010.pdf

 

This will likely give you every city, but it's a long route. 

 

If you only have the few missing you listed, I would probably be lazy and do it manually. The approach above is automated but longer.

Contributor
Posts: 30

Re: GMAPs With Canada City Information

Ok, found it.  Was looking in the wrong link.  Just downloaded and , wouldn't you know it, the cities I need are still not there.  I guess I'll have use the proc geocode to create derive them...Lord help me.  I'm really a novice and very new at this whole 'GEO' mapping and graphing thing.

 

Again, thanks for all your help!!!

Super User
Posts: 22,823

Re: GMAPs With Canada City Information

Posted in reply to bendsteel6

Most places have another look up table that simplifies this, but unfortunately it's proprietary data. 

 

I've assumed you're a student and have no access to other sources. Otherwise, most companies and governments have different sources Smiley Happy

Contributor
Posts: 30

Re: GMAPs With Canada City Information

No, not a student.  I work for a Volvo Trucks North America.  My access to SAS is limited to SAS EG on a CITRIX box linked to a server in Sweden.  I don't have a lot of latitude with adding or changing system libraries, files and the like. I've got some reading and learning to do.

Super User
Posts: 22,823

Re: GMAPs With Canada City Information

Posted in reply to bendsteel6

Then ask around your company. I'm surprised they don't have a GIS unit, I'd suspect you do somewhere and they'll have the data you need. You can also purchase the data here:

 

https://zipcodedownload.com/

 

This is the one recommended by SAS and is dirt cheap. 

 

An option we use internally here is:

https://www.dmtispatial.com/

 

There's a file that can be purchased from Statistics Canada or Canada Post and I'd be surprised if your marketing team didn't have a copy of that. 

 

Good Luck!

Contributor
Posts: 30

Re: GMAPs With Canada City Information

Ok, will do.  Again, Thanks for your help and attention on this Smiley Happy

SAS Employee
Posts: 1,024

Re: GMAPs With Canada City Information

Posted in reply to bendsteel6

If the cities aren't in mapsgfk.world_cities, you might can look them up manually in Google maps, and then enter the lat/long into a dataset...

 

For example, go to maps.google.com

Search for "Levis, Canada"

Then look in the URL, and pick out the lat/long, such as "@46.710684,-71.255107", and copy-n-paste those numbers into your file/spreadsheet/wherever.

 

It's a bit tedious, but it's one way to get the job done.

 

Ask a Question
Discussion stats
  • 14 replies
  • 225 views
  • 1 like
  • 3 in conversation