Data visualization with SAS programming

Using annotate and proc gproject with European cities

Reply
N/A
Posts: 0

Using annotate and proc gproject with European cities

Hello and thanks in advance.

I have a group of European cities I am trying to set up as an annotate dataset. I got the longitude and latitude of the cities from the worldcts sas dataset that I downloaded today.

here's how I got the long & lat:
create table worldcts as
select cname, city,
(atan(1)/45 * -1 *long) as x, (atan(1)/45 * lat) as y
from wct.worldcts

then I merged this dataset with my small group of cities.

I'm getting an error in my log when I run gproject, can anyone help?

1042
1043 /* Project the maps. ASIS permits duplicate observations to */
1044 /* exist in the data and should be used whenever ANNOTATE */
1045 /* observations are included in a projection. */
1046 proc gproject data=all out=allp asis ;
1047 id city;
1048 run;

NOTE: PARALLEL1 = -1.195555979.
NOTE: PARALLEL2 = 55.350554674.
ERROR: Standard parallels lie on opposite sides of the equator.
ERROR: Equator is too close to the median latitude of the map data set for
default parallel calculation. Try specifying PARALLEL1 and PARALLEL2
values explicitly.

europemap is made like this:
/* Get the europe map */
create table europemap as
select long as x, lat as y, cont, id, segment
from maps.europe ;

My annotate dataset (before I "set" it together with the europe map):

City Name Country Name x y xsys ysys hsys when anno_flag text color style size position

AMSTERDAM Netherlands 0.08563 0.91426 2 2 3 a 1 . 5
AMSTERDAM South Africa 0.53527 -0.46458 2 2 3 a 1 . 5
BIRMINGHAM United Kingdom -0.033 0.91591 2 2 3 a 1 V DAGB marker 1 5
BONN Germany 0.12337 0.88542 2 2 3 a 1 V DAGB marker 1 5
BREMEN Germany 0.15403 0.92634 2 2 3 a 1 . 5
BRESCIA Italy 0.17801 0.79492 2 2 3 a 1 . 5
BRUSSEL . . 2 2 3 a 1 V DAGB marker 1 5
CARSHALTON, SURREY . . 2 2 3 a 1 V DAGB marker 1 5
GENOVA Italy 0.15499 0.77528 2 2 3 a 1 V DAGB marker 1 5
GRONINGEN Netherlands 0.11495 0.92865 2 2 3 a 1 V DAGB marker 1 5
GRONINGEN Suriname -0.96808 0.10123 2 2 3 a 1 V DAGB marker 1 5
LEIDEN Netherlands 0.07818 0.91049 2 2 3 a 1 . 5
LEUVEN Belgium 0.08234 0.88813 2 2 3 a 1 V DAGB marker 1 5
LONDON Canada -1.41786 0.75031 2 2 3 a 1 V DAGB marker 1 5
LONDON Kiribati -2.74882 0.03491 2 2 3 a 1 V DAGB marker 1 5
LONDON United Kingdom -0.00113 0.89906 2 2 3 a 1 V DAGB marker 1 5
MÜNCHEN . . 2 2 3 a 1 . 5
NIJMEGEN Netherlands 0.10206 0.9049 2 2 3 a 1 . 5
PARIS France 0.04091 0.85273 2 2 3 a 1 V DAGB marker 1 5
PARIS France 0.04091 0.85273 2 2 3 a 1 V DAGB marker 1 5
PARMA Italy 0.18032 0.78203 2 2 3 a 1 . 5
ROMA Australia 2.59701 -0.46389 2 2 3 a 1 V DAGB marker 1 5
ROMA Lesotho 0.48418 -0.51432 2 2 3 a 1 V DAGB marker 1 5
ROTTERDAM Netherlands 0.07864 0.90604 2 2 3 a 1 V DAGB marker 1 5
UTRECHT Netherlands 0.08914 0.90941 2 2 3 a 1 . 5
UTRECHT South Africa 0.52925 -0.4829 2 2 3 a 1 . 5
SAS Employee
Posts: 963

Re: Using annotate and proc gproject with European cities

Based on the few pieces of code & data, I'm not sure what you're trying to do makes geographical sense(?) ...

You're taking maps.europe, and combining it with world cities (many of which aren't in europe), and then gprojecting them together. You would really only want to project lat/long points with a given map, if those points are in the same geographical area as that map. It doesn't really make sense to project a map of europe and lat/long points from Africa and Australia at the same time.

Per this particular error message, the default projection method for "proc gproject" is "Albers", and SAS' albers projection isn't really up to the task of projecting a map that has coordinates in both the Northern and Southern hemisphere. You can see the same error by trying to gproject all the coordinates of maps.world at the same time.

You can probably work around this error message by specifying another projection technique (such as "project=hammer") ... but you you should really decide whether you want just Europe, or Europe & Africa/Australia/etc first.
N/A
Posts: 0

Re: Using annotate and proc gproject with European cities

Thanks for your help. I am combining my list of cities with the world cities dataset but I am only keeping my list of cities, so I think they are all in the same general area (Europe). The dataset I posted is the entirety of the anno dataset I am using. Here's a code snippet.

1023 data anno_cities;
1024 merge site_cities(in=sites) worldcts;
1025 by city;
1026 if sites;
...etc.

I did manage to make this work using project=robinson and got the following warning message
NOTE: The ROBINSON projection is experimental.
NOTE: POLELONG = 4.3491667794.

Which is fine but I'd like to figure out how to do it "right". To address the point you raised, I do want just Europe at this time but the only dataset I can use to get city lat/long is the worldcts, as far as I know.

Please let me know if I need to post more code or explanation. (And thanks for the quick response. i was on vacation last week and today is my first day back.)
SAS Employee
Posts: 963

Re: Using annotate and proc gproject with European cities

Your list has cities from Australia and South Africa (which are in the southern hemisphere) - and certain SAS projection techniques (such as the default Albers) aren't suited for projecting a map with coordinates in both the northern and southern hemishpheres.

The projection techniques which are production (versus experimental) will vary, depending on which version of SAS you're using. You can check your SAS/Graph doc, or tech support can help you figure out which are "production" in the version of SAS you have.

For a graphical peek at what maps resulting from various projection techniques look like, see the following:

http://robslink.com/SAS/democd34/aaaindex.htm
N/A
Posts: 0

Re: Using annotate and proc gproject with European cities

gotcha.

It's a merge problem higher up. For example, Paris should only have one set of lat/long. Same for Groningen. I will work on that. Thanks very much for your help & the helpful link!
Post a Question
Discussion Stats
  • 4 replies
  • 261 views
  • 0 likes
  • 2 in conversation