- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
This my first attempt to transform latitudes and longitudes into UTM (Zone 18) coordinates using SAS. PROC GPROJECT PROJECT=proj4 seems to be what I need but I can’t get the desired result :
data have;
id=1; lat=45.5; long=73.5;
run;
proc gproject latlon degrees westlong
project=proj4 to="EPSG:32618" /* WGS 84 / UTM zone 18N */
data=have out=want;
id id;
run;
proc print data=want noobs; run;
X Y id lat long
1.28282 0.79412 1 45.5 73.5
X and Y are clearly not what I expect. Please help!
PG
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you Darrell, I got it now. It turns out that options EASTLONG, WESTLONG and DEGREES are ignored for METHOD=PROJ4. Longitudes must be within the specified limits for the UTM zone (and negative), otherwise GPROJECT gives garbage without any warning. The correct projection will be given by:
data have;
id=1; lat=45.5; long=-73.5;
run;
proc gproject latlon
project=proj4 to="EPSG:32618" /* WGS 84 / UTM zone 18N */
data=have out=want;
id id;
run;
proc print data=want noobs; run;
X Y id lat long
617189.99 5039590.76 1 45.5 -73.5
PG
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I would try adding a few other points.
In 9.3 with any of the available projections except NONE a single points yields output of 0,0. So it may be an effect of not having something else to generate.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
It has been awhile since I tried projecting any data from lat/long but my results back then seemed to yield a x in the -1 to 1 and y in -1 to 2 range. I suspect those results were just SAS drawing coordinate for GMap. Maybe something similar is happening here?!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
What numbers are you expecting?
The doc says: The DEGREES and EASTLONG options are enabled with the PROJ4 projection method.
I think that means you CANNOT turn on WESTLONG. I think the doc isn't very clear on this.
Also, the PROJ4 doc says the LONG/LAT must be: -78.0000, 0.0000, -72.0000, 84.0000
(WGS 84 / UTM zone 18N: EPSG Projection -- Spatial Reference)
So, you need to change your value to EASTLONG.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you Darrell, I got it now. It turns out that options EASTLONG, WESTLONG and DEGREES are ignored for METHOD=PROJ4. Longitudes must be within the specified limits for the UTM zone (and negative), otherwise GPROJECT gives garbage without any warning. The correct projection will be given by:
data have;
id=1; lat=45.5; long=-73.5;
run;
proc gproject latlon
project=proj4 to="EPSG:32618" /* WGS 84 / UTM zone 18N */
data=have out=want;
id id;
run;
proc print data=want noobs; run;
X Y id lat long
617189.99 5039590.76 1 45.5 -73.5
PG
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi, I have a problem somewhat similar... here is a output test ; coordoninate are lat long from Canada territory.
long = -52.7 ;
lat = 47.5 ;
project=proj4 to="EPSG:3347"
data=have out=want;
id id ;
X | Y | id | long | lat |
---|---|---|---|---|
10261036.29 | 2376434.81 | CA-1001 | -52.7 |
47.5 |
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Guy,
What is the projection that you are trying to convert into? The values that you are getting from the proc for that EPSG value appear to be correct. I looked up the range of values for the UTM represented by EPSG:3347, and those returned values are in the expected range.
For reference, here is the definition of EPSG 3347 from spatialreference.org that I used:
http://spatialreference.org/ref/epsg/nad83-statistics-canada-lambert/
Thanks,
Scott
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I found the ligth at the end of the tunnel... The problem was not a conversion problem.... I was in the Mapsgfk.canada and Mapsgfk.canada_attr map files. The X and Y variables used in those maps were generated by the map provider... I could not find any way of converting external points in Latitude and longitude to those internal coordinates. The solution was so simple, I imported the Canadian SHP map file from open data Stat Can with MAPIMPORT... The coordinates X Y in the map is in Latitude and longitude... so I repeated the program and all is good. Hoping my experience can be useful for someone in the future.
Best retards Scott
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Best Regards 😉