Friedrich,
As I tried to explain in my previous post, many projections have a "point of view" (my term, probably not what cartographers would use). I was able to generate the rather pleasant representation of Canada in #13 using the default parameters for the albers projection. As explained in geo2xy's help file, if you use the defaults, three of the 6 parameters (lat1 lat2 lon0) are dynamically generated and therefore depend on the contents of the shapefile:
You can use return list after a call to geo2xy to view the values of the parameters. Here are the ones for the albers Canada map in #13
I think that geo2xy's defaults for the albers projection will work well for most maps (including the Canada map in #13). With a map of the whole world however, if lat1 and lat2 are automatically computed by geo2xy as described above, you will get one in the northern hemisphere and the other in the southern hemisphere (which explains the odd look of the map you showed).
The Wikipedia image you show has the following caption
In order to specify some projection parameters, you have to specify all of them. Here's code that duplicates the Wikipedia map of the world
And this is the map
Of course some would say that this is a biased representation of the world and would prefer
which yields
As I tried to explain in my previous post, many projections have a "point of view" (my term, probably not what cartographers would use). I was able to generate the rather pleasant representation of Canada in #13 using the default parameters for the albers projection. As explained in geo2xy's help file, if you use the defaults, three of the 6 parameters (lat1 lat2 lon0) are dynamically generated and therefore depend on the contents of the shapefile:
Code:
Parameters Description -------------------------------------------------------------------------------------- a semi-major axis of reference ellipsoid (default is 6378137) f inverse flattening of reference ellipsoid (default is 298.257223563) lat1 1st standard parallel (default is minlat + (maxlat - minlat) / 6) lat2 2nd standard parallel (default is maxlat - (maxlat - minlat) / 6) lat0 projection's origin (default is 0) lon0 central meridian (default is mid-longitude) --------------------------------------------------------------------------------------
Code:
. * convert coordinates using -geo2xy- . geo2xy _Y _X if _ID == 40, projection(albers) replace . return list macros: r(aspect) : ".8554784976405909" r(model) : "Ellipsoid (6378137,298.257223563)" r(pname) : "Albers Equal-Area Conic Projection" r(lon0) : "-96.82789557573588" r(lat2) : "76.20924178062862" r(lat1) : "48.58174639206324" r(lat0) : "0" r(f) : "298.257223563" r(a) : "6378137"
The Wikipedia image you show has the following caption
Albers projection of the world with standard parallels 20°N and 50°N.
In order to specify some projection parameters, you have to specify all of them. Here's code that duplicates the Wikipedia map of the world
Code:
use "worldcoord.dta", clear * fix overflow errors in the shapefile data replace _X = -180 if _X < -180 replace _X = 180 if _X > 180 & !mi(_X) * convert coordinates using -geo2xy- geo2xy _Y _X if _ID!=13, proj(albers, 6378137 298.257223563 20 50 0 0) replace save "worldcoord_albers.dta", replace * create map use "UNfertdata.dta" spmap TFR1970 using "worldcoord_albers" if id!=13, /// id(id) fcolor(Rainbow) clmethod(custom) clbreaks(1 2 3 4 5 6 7 8) legcount
Code:
use "worldcoord.dta", clear * fix overflow errors in the shapefile data replace _X = -180 if _X < -180 replace _X = 180 if _X > 180 & !mi(_X) geo2xy _Y _X if _ID!=13, proj(albers, 6378137 298.257223563 0 -30 0 15) replace save "worldcoord_albers.dta", replace * create map use "UNfertdata.dta" spmap TFR1970 using "worldcoord_albers" if id!=13, /// id(id) fcolor(Rainbow) clmethod(custom) clbreaks(1 2 3 4 5 6 7 8) legcount graph export "world3albers.png", width(600) replace
Comment