Hi,
I am using a shapefile for local authority districts in the UK and trying to add data points from another source. I have the geographic longitude and latitude for each data point and I used Geo2xy to obtain the projected coordinates. However, the projected coordinates do not match the shapefile and the points appear far away from the map itself.
These are the details of the shapefile coordinates:
PROJCS["OSGB_1936_British_National_Grid",GEOGCS["GCS_OSGB 1936",DATUM["D_OSGB_1936",SPHEROID["Airy_1830",6377563.396,299.3249646]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",49],PARAMETER["central_meridian",-2],PARAMETER["scale_factor",0.9996012717],PARAMETER["false_easting",400000],PARAMETER["false_northing",-100000],UNIT["Meter",1]]
This is the code I used:
use "location_coords.dta", clear
geo2xy Latitude Longitude, generate(y_lat x_lon) projection(mercator, 6377563.396 299.3249646 0)
save "New_coords.dta", replace
use "LAD.dta", clear
spmap using "LAD_shp.dta", ///
id(_ID) ocolor(gs10 ..) osize(0.04 ..) ///
point(data("New_coords.dta") x(x_lon) y(y_lat) fcolor(red))
Thanks!
Nitzan
I am using a shapefile for local authority districts in the UK and trying to add data points from another source. I have the geographic longitude and latitude for each data point and I used Geo2xy to obtain the projected coordinates. However, the projected coordinates do not match the shapefile and the points appear far away from the map itself.
These are the details of the shapefile coordinates:
PROJCS["OSGB_1936_British_National_Grid",GEOGCS["GCS_OSGB 1936",DATUM["D_OSGB_1936",SPHEROID["Airy_1830",6377563.396,299.3249646]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",49],PARAMETER["central_meridian",-2],PARAMETER["scale_factor",0.9996012717],PARAMETER["false_easting",400000],PARAMETER["false_northing",-100000],UNIT["Meter",1]]
This is the code I used:
use "location_coords.dta", clear
geo2xy Latitude Longitude, generate(y_lat x_lon) projection(mercator, 6377563.396 299.3249646 0)
save "New_coords.dta", replace
use "LAD.dta", clear
spmap using "LAD_shp.dta", ///
id(_ID) ocolor(gs10 ..) osize(0.04 ..) ///
point(data("New_coords.dta") x(x_lon) y(y_lat) fcolor(red))
Thanks!
Nitzan
Comment