# Proj4 WKT - Cartesian with origin to EPSG900913

I'm converting wgs84 to cartesian with origin using simple function in c#

``````public static double[] LL_TO_XY(double latitude, double longitude, double originLatitude, double originLongitude)
{

//var xx,yy,r,ct,st,angle;
double xx;
double yy;
double r;
double ct;
double st;
double angle;
double rotation_angle_degs = 0;
double xoffset_mtrs = 0;
double yoffset_mtrs = 0;
double pxpos_mtrs;
double pypos_mtrs;
double[] p = new double[2];

xx = (longitude - originLongitude)*METERS_DEGLON(originLatitude);
yy = (latitude - originLatitude)*METERS_DEGLAT(originLatitude);

r = Mathd.Sqrt(xx*xx + yy*yy);

/* alert('LL_TO_XY: xx=' + xx + ' yy=' + yy + ' r=' + r);
return false;*/

//if(r)
//{
ct = xx/r;
st = yy/r;
xx = r * ( (ct * Mathd.Cos(angle)) + (st * Mathd.Sin(angle)) );
yy = r * ( (st * Mathd.Cos(angle)) - (ct * Mathd.Sin(angle)) );
//}
pxpos_mtrs = xx + xoffset_mtrs;
pypos_mtrs = yy + yoffset_mtrs;

p [0] = pxpos_mtrs;
p [1] = pypos_mtrs;
return p;

}
``````

Now I want to convert these cartesian values into EPSG900913. I can use proj4 for this so I think it should be better.

I know that to convert from WGS84 to EPSG900913 I need to define WKT for proj4 like this:

``````private static string wktEPSG900913 =
"PROJCS[\"WGS84 / Simple Mercator\", " +
"GEOGCS[\"WGS 84\", " +
"DATUM[\"World Geodetic System 1984\", SPHEROID[\"WGS 84\", 6378137.0, 298.257223563,AUTHORITY[\"EPSG\",\"7030\"]], " +
"AUTHORITY[\"EPSG\",\"6326\"]]," +
"PRIMEM[\"Greenwich\", 0.0, AUTHORITY[\"EPSG\",\"8901\"]], " +
"UNIT[\"degree\",0.017453292519943295], " +
"AXIS[\"Longitude\", EAST], AXIS[\"Latitude\", NORTH]," +
"AUTHORITY[\"EPSG\",\"4326\"]], " +
"PROJECTION[\"Mercator_1SP\"]," +
"PARAMETER[\"semi_minor\", 6378137.0], " +
"PARAMETER[\"latitude_of_origin\",0.0], " +
"PARAMETER[\"central_meridian\", 0.0], " +
"PARAMETER[\"scale_factor\",1.0], " +
"PARAMETER[\"false_easting\", 0.0], " +
"PARAMETER[\"false_northing\", 0.0]," +
"UNIT[\"m\", 1.0], " +
"AXIS[\"x\", EAST], AXIS[\"y\", NORTH]," +
"AUTHORITY[\"EPSG\",\"900913\"]]";
``````

What WKT I need to use to convert from cartesian with origin to EPSG900913?