BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
young_spruce
Fluorite | Level 6

Hi,

 

I want to show markers on a map using the PROC GMAP statement (following this example). However, I think my map data uses a different type of data compared to my marker data.

 

How can I manipulate my data so that I can show markers on my map? I have tried the code below unsuccesfully. 

 

Thanks in advance for any help.

 

The code

proc gproject data=marker_data out=marker_data eastlong latlong degrees;
id pc4nr;
run;

 

My Netherlands map data uses the following XY coordinates

X Y
122146.69994 487964.19995
122192.39992 487945.20011
122265.2 487932.00006
122301.70003 487966.79998
122515.99996 487935.89999
122534.30007 487892.70001

 

My marker_data  uses LATLONG codes

lat long
52.1392 5.0417
52.1392 5.0417
52.025 4.8681
52.025 4.8681
52.1392 5.0417

 

My marker_data  after GJPROJECT 

X Y
-0.005838858 -0.005235953
-0.005838858 -0.005235953
-0.007718145 -0.007212797
-0.007718145 -0.007212797
-0.005838858 -0.005235953

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
GraphGuy
Meteorite | Level 14

Looks like the X & Y in your map dataset is already projected, or in a different coordinate system.

You'll need to find out what projection/coordinate-system was used for the map, and then either "unproject" the map X/Y's to get them into lat/long coordinates (same as your marker data), or project your marker data the same way. (Modern versions of Proc Gproject have a from= and to= option that can help in converting). I usually get both the map and marker data into lat/long, and then project them both, using a projection before plotting them together.

 

When you tried projecting your marker data, it just used SAS' "default projection" ... which is not the same projection that was used to project your map.

 

View solution in original post

7 REPLIES 7
ChrisNZ
Tourmaline | Level 20

My Netherlands map data uses the following XY coordinates

X Y
122146.69994 487964.19995

 

What do these numbers represent? In order to translate, you need a translation rule.

Do you have a couple of points in both coordinate systems?

young_spruce
Fluorite | Level 6

Hi Chris,

 

Thanks for the quick reply.

 

Those numbers represent some type of coordinates per Dutch zipcode (4 digits). The map data is a set we had lying around at the office.

 

For zipcode 1011 and 1012, my map data contains:

XYPC4NR
122146.69994487964.199951011
122192.39992487945.200111011
122265.2487932.000061011
122301.70003487966.799981011
122515.99996487935.899991011
122534.30007487892.700011011
122604.19995487881.300111011
122623.79997487682.300031011
122691.20003487652.599971011
122762.20003487253.299921011
122673.80005487088.699931011
122249.49991486641.700011011
121923.30006486531.900051011
121837.09992486639.699951011
121722.79996486711.800091011
121524.39992486751.099911011
121899.8999487422.099931011
121940.80003487820.999931011
122079.60006487836.999921011
122146.69994487964.199951011
121409.6488033.10011012
121608.89998488308.299931012
121624.40009488294.200041012
121759.2488197.300031012
122114.40001487977.599921012
122146.69994487964.199951012
122079.60006487836.999921012
121940.80003487820.999931012
121899.8999487422.099931012
121524.39992486751.099911012
121313486706.000071012
121123.29994486701.700091012
121010.60007486854.399921012
120995.59993486931.20011012
121098.4001487516.50011012
121409.6488033.10011012

 

My zipcode coordinate data set contains the following data for that same zipcode:

LongitudeLatitudePostal Code
49.027523.6661011
49.027523.6661012
ChrisNZ
Tourmaline | Level 20

1. Both zip codes at the same location?

 

2. So many X Y to one LAT LON?

I'm getting lost here. Can you give more context?

You might need to use the centroids (which can be approximated using the averages for now) then.

1011:

122231.7799825 487475.77499

1012:

121566.149998125 487584.3000025

 

3. Why not use the SAS/GRAPH NL map?

young_spruce
Fluorite | Level 6

Answers:

1. They are the same zipcode so they should represent the same location.

 

2. I'm unsure why there are so many XY values per zipcode. The data set was already present, but the person who created that dataset is no longer working here. I found the zipcode LATLON data online. It did not contain any further documentation.

 

3. I could use the SAS MAP if there's a way to create zipcode boundaries. The NL map only contains province boundaries. The data I have is zipcode based. I need to create that countains specific boundaries (administrative regions for Dutch longterm healthcare based on zipcodes). The map data we have does contain does those boundaries.

 

Questions:

A. In your second answer you mention using centroids. Would it be an option to use my current map data to create centroids per zipcode, geocode those centroids to my zipcode data set and then plot those on my map?

ChrisNZ
Tourmaline | Level 20

How are zip code 1011 and zip code 1012 the same?

This website disagrees http://www.geonames.org/postalcode-search.html?q=1011&country=NL

 

What happens when you run

proc gmap data=NLMAP(keep=X Y PC4NR) map=NLMAP;
  id PC4NR;
  choro X ;
run;
quit;

 

young_spruce
Fluorite | Level 6

Hi Chris,

 

I'm sorry for the misunderstanding. Zipcode 1011 and 1012 are not the same. I thought you meant the same for both my data sets. I included two observations, to make it more clear. 

 

Last night (I could not let this rest) I had a breakthrough. It turns out my map data uses a Dutch system, known as the National Triangular System (Rijksdriehoekstelsel or EPSG:28992). It uses meters from a random zero point and allows all of Western Europe to have positive values so that there's no misunderstanding about left or right. The Dutch Navi provided a program to translate that system to latitude and longitude data, so I'll try to run that. 

 

I think this solves my problem for now. I like the boundaries of the SAS map more than I like those of my zip code data (water also has a zipcode), but that is a different question. 

 

Thanks for all your time and effort in solving this problem. 

 

PS running your code gave me the attached result.

 

GraphGuy
Meteorite | Level 14

Looks like the X & Y in your map dataset is already projected, or in a different coordinate system.

You'll need to find out what projection/coordinate-system was used for the map, and then either "unproject" the map X/Y's to get them into lat/long coordinates (same as your marker data), or project your marker data the same way. (Modern versions of Proc Gproject have a from= and to= option that can help in converting). I usually get both the map and marker data into lat/long, and then project them both, using a projection before plotting them together.

 

When you tried projecting your marker data, it just used SAS' "default projection" ... which is not the same projection that was used to project your map.

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 7 replies
  • 2404 views
  • 2 likes
  • 3 in conversation