# How can I convert x y co-ordinate to degree decimal

**URL:** <https://community.thinkgeo.com/t/how-can-i-convert-x-y-co-ordinate-to-degree-decimal/4080>\
**Category:** MVC\
**Created:** [August 19, 2013, 6:56am UTC](https://community.thinkgeo.com/t/how-can-i-convert-x-y-co-ordinate-to-degree-decimal/4080 "2013-08-19T06:56:06Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yogesh](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/y/49beb7/32.png) [@Yogesh](https://community.thinkgeo.com/u/Yogesh)\
**Post date:** [August 19, 2013, 6:56am UTC](https://community.thinkgeo.com/t/how-can-i-convert-x-y-co-ordinate-to-degree-decimal/4080/1 "2013-08-19T06:56:06Z")

</div>

hi…  
  
I&nbsp;have&nbsp;created&nbsp;map&nbsp;app.&nbsp;with&nbsp;using&nbsp;thinkgeo.&nbsp;I&nbsp;am&nbsp;currently&nbsp;trying&nbsp;to&nbsp;put&nbsp;marker&nbsp;on&nbsp;map&nbsp;with&nbsp;specific&nbsp;x&nbsp;and&nbsp;y&nbsp;positions,&nbsp;but&nbsp;I&nbsp;have&nbsp;faced&nbsp;problem&nbsp;with&nbsp;that&nbsp;I&nbsp;can’t&nbsp;transform&nbsp;my&nbsp;own&nbsp;co-ordinate’s&nbsp;because&nbsp;it&nbsp;is&nbsp;for&nbsp;google&nbsp;map&nbsp;and&nbsp;I&nbsp;want&nbsp;to&nbsp;convert&nbsp;it&nbsp;into&nbsp;thinkgeo&nbsp;map&nbsp;co-ordinate’s.&nbsp;I&nbsp;have&nbsp;put&nbsp;here&nbsp;my&nbsp;code&nbsp;for&nbsp;converting&nbsp;this&nbsp;with&nbsp;javascript.&nbsp;Please,&nbsp;reply&nbsp;as&nbsp;soon&nbsp;as&nbsp;possible.  
  
  
  
&nbsp;var&nbsp;point&nbsp;=&nbsp;new&nbsp;OpenLayers.Geometry.Point(x,&nbsp;y);  
  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;srcProj&nbsp;=&nbsp;new&nbsp;OpenLayers.Projection(‘EPSG:3857’);  
  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;desProj&nbsp;=&nbsp;new&nbsp;OpenLayers.Projection(‘EPSG:32723’);  
  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;newPoint&nbsp;=&nbsp;OpenLayers.Projection.transform(point,&nbsp;srcProj,&nbsp;desProj);  
  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;newX&nbsp;=&nbsp;newPoint.x;  
  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;newY&nbsp;=&nbsp;newPoint.y;  
  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Map1.panToWorldCoordinate(newX,&nbsp;newY);  
  
&nbsp;&nbsp;&nbsp;&nbsp;

---

<div class="post-metadata">

**Author:** ![Jean-marie](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/j/a183cd/32.png) [@Jean-marie](https://community.thinkgeo.com/u/Jean-marie)\
**Post date:** [August 19, 2013, 4:37pm UTC](https://community.thinkgeo.com/t/how-can-i-convert-x-y-co-ordinate-to-degree-decimal/4080/2 "2013-08-19T16:37:55Z")

</div>

Hi,&nbsp;  
&nbsp;&nbsp;  
&nbsp;try&nbsp;this:&nbsp;  
&nbsp;&nbsp;  
&nbsp;public&nbsp;Proj4Projection&nbsp;Prj4Mercator()&nbsp;  
&nbsp;{&nbsp;  
&nbsp;&nbsp;&nbsp;Proj4Projection&nbsp;\_prj&nbsp;=&nbsp;new&nbsp;Proj4Projection();&nbsp;  
&nbsp;&nbsp;&nbsp;\_prj.ExternalProjectionParametersString&nbsp;=&nbsp;Proj4Projection.GetGoogleMapParametersString();&nbsp;  
&nbsp;&nbsp;&nbsp;\_prj.InternalProjectionParametersString&nbsp;=&nbsp;Proj4Projection.GetEpsgParametersString(4326);&nbsp;  
&nbsp;&nbsp;&nbsp;\_prj.Open();&nbsp;  
&nbsp;&nbsp;&nbsp;return&nbsp;(\_prj);&nbsp;  
&nbsp;}&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;  
&nbsp;then&nbsp;use&nbsp;this&nbsp;code.&nbsp;  
&nbsp;&nbsp;  
&nbsp;PointShape&nbsp;\_gpsPointShape&nbsp;=&nbsp;new&nbsp;PointShape();&nbsp;  
&nbsp;double&nbsp;\_GPSlongitude&nbsp;=&nbsp;0;&nbsp;  
&nbsp;double&nbsp;\_GPSlatitude&nbsp;=&nbsp;0;&nbsp;  
&nbsp;&nbsp;  
&nbsp;Proj4Projection&nbsp;proj4&nbsp;=&nbsp;this.Prj4Mercator();&nbsp;  
&nbsp;proj4.Open();&nbsp;  
&nbsp;\_GPSlongitude&nbsp;=&nbsp;Convert.ToDouble(args["x"],&nbsp;CultureInfo.InvariantCulture);&nbsp;  
&nbsp;\_GPSlatitude&nbsp;=&nbsp;Convert.ToDouble(args["y"],&nbsp;CultureInfo.InvariantCulture);&nbsp;  
&nbsp;\_gpsPointShape&nbsp;=&nbsp;new&nbsp;PointShape(new&nbsp;Vertex(\_GPSlongitude,&nbsp;\_GPSlatitude));&nbsp;  
&nbsp;GpsFeature&nbsp;=&nbsp;new&nbsp;Feature(proj4.ConvertToExternalProjection(\_gpsPointShape));&nbsp;  
&nbsp;proj4.Close();&nbsp;  
&nbsp;&nbsp;

---

<div class="post-metadata">

**Author:** ![Jean-marie](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/j/a183cd/32.png) [@Jean-marie](https://community.thinkgeo.com/u/Jean-marie)\
**Post date:** [August 19, 2013, 4:40pm UTC](https://community.thinkgeo.com/t/how-can-i-convert-x-y-co-ordinate-to-degree-decimal/4080/3 "2013-08-19T16:40:16Z")

</div>

Sorry&nbsp;it&nbsp;was&nbsp;C#&nbsp;code&nbsp;&nbsp;  
&nbsp;&nbsp;  
&nbsp;now&nbsp;this&nbsp;is&nbsp;for&nbsp;javascript:&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;  
&nbsp;function&nbsp;findProperty(lon,&nbsp;lat)&nbsp;{&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;fromProjection&nbsp;=&nbsp;new&nbsp;OpenLayers.Projection("EPSG:4326");&nbsp;&nbsp;&nbsp;//&nbsp;Transform&nbsp;from&nbsp;WGS&nbsp;1984&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;toProjection&nbsp;=&nbsp;new&nbsp;OpenLayers.Projection("EPSG:900913");&nbsp;//&nbsp;to&nbsp;Spherical&nbsp;Mercator&nbsp;Projection&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;position&nbsp;=&nbsp;new&nbsp;OpenLayers.LonLat(lon,&nbsp;lat).transform(fromProjection,&nbsp;toProjection);&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Map1.setCenter(position,&nbsp;12);&nbsp;  
&nbsp;}&nbsp;

---

<div class="post-metadata">

**Author:** ![Summer1](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/s/c89c15/32.png) [@Summer1](https://community.thinkgeo.com/u/Summer1)\
**Post date:** [August 20, 2013, 4:00am UTC](https://community.thinkgeo.com/t/how-can-i-convert-x-y-co-ordinate-to-degree-decimal/4080/4 "2013-08-20T04:00:10Z")

</div>

Hi&nbsp;Yogesh&nbsp;And&nbsp;JM,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks&nbsp;for&nbsp;Yogesh’S&nbsp;post&nbsp;and&nbsp;welcoem&nbsp;to&nbsp;MapSuite&nbsp;World.&nbsp;Thanks&nbsp;for&nbsp;Jean&nbsp;Marie’s&nbsp;sharing.&nbsp;Jean&nbsp;Marie’s&nbsp;reply&nbsp;on&nbsp;“08-19-2013&nbsp;09:39&nbsp;PM”&nbsp;is&nbsp;basicly&nbsp;right,&nbsp;but&nbsp;there&nbsp;might&nbsp;be&nbsp;a&nbsp;slight&nbsp;admendment:&nbsp;If&nbsp;the&nbsp;marker’s&nbsp;srcProj&nbsp;might&nbsp;not&nbsp;be&nbsp;the&nbsp;“EPSG:4326”,&nbsp;please&nbsp;replace&nbsp;it&nbsp;with&nbsp;marker’s&nbsp;srcProj,&nbsp;So&nbsp;the&nbsp;code&nbsp;should&nbsp;be:&nbsp;  
&nbsp;&nbsp;  
&nbsp;function&nbsp;findProperty(lon,&nbsp;lat)&nbsp;{&nbsp;&nbsp;  
&nbsp;&nbsp;var&nbsp;fromProjection&nbsp;=&nbsp;new&nbsp;OpenLayers.Projection(”EPSG:marker’s&nbsp;srcProj");&nbsp;//&nbsp;Transform&nbsp;from&nbsp;WGS&nbsp;1984&nbsp;&nbsp;  
&nbsp;&nbsp;var&nbsp;toProjection&nbsp;=&nbsp;new&nbsp;OpenLayers.Projection(“EPSG:900913”);&nbsp;//&nbsp;to&nbsp;Spherical&nbsp;Mercator&nbsp;Projection&nbsp;&nbsp;  
&nbsp;&nbsp;var&nbsp;position&nbsp;=&nbsp;new&nbsp;OpenLayers.LonLat(lon,&nbsp;lat).transform(fromProjection,&nbsp;toProjection);&nbsp;&nbsp;  
&nbsp;&nbsp;Map1.setCenter(position,&nbsp;12);&nbsp;&nbsp;  
&nbsp;&nbsp;}&nbsp;&nbsp;  
&nbsp;&nbsp;  
&nbsp;if&nbsp;you&nbsp;have&nbsp;any&nbsp;more&nbsp;question&nbsp;,&nbsp;please&nbsp;feel&nbsp;free&nbsp;to&nbsp;let&nbsp;us&nbsp;know.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Best&nbsp;Regards&nbsp;  
&nbsp;&nbsp;  
&nbsp;Summer

---

<div class="post-metadata">

**Author:** ![Yogesh](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/y/49beb7/32.png) [@Yogesh](https://community.thinkgeo.com/u/Yogesh)\
**Post date:** [August 21, 2013, 7:20am UTC](https://community.thinkgeo.com/t/how-can-i-convert-x-y-co-ordinate-to-degree-decimal/4080/5 "2013-08-21T07:20:43Z")

</div>

hi…  
  
  
  
I&nbsp;have&nbsp;tried&nbsp;this&nbsp;code&nbsp;but&nbsp;I&nbsp;don’t&nbsp;get&nbsp;the&nbsp;solution.&nbsp;It&nbsp;is&nbsp;not&nbsp;converted&nbsp;with&nbsp;latitude&nbsp;and&nbsp;longitude&nbsp;values.&nbsp;Please&nbsp;give&nbsp;another&nbsp;solution&nbsp;for&nbsp;that.&nbsp;I&nbsp;am&nbsp;not&nbsp;getting&nbsp;the&nbsp;marker&nbsp;with&nbsp;proper&nbsp;place&nbsp;on&nbsp;google&nbsp;map.

---

<div class="post-metadata">

**Author:** ![Summer1](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/s/c89c15/32.png) [@Summer1](https://community.thinkgeo.com/u/Summer1)\
**Post date:** [August 22, 2013, 4:15am UTC](https://community.thinkgeo.com/t/how-can-i-convert-x-y-co-ordinate-to-degree-decimal/4080/6 "2013-08-22T04:15:40Z")

</div>

Hi&nbsp;Yogesh,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks&nbsp;for&nbsp;your&nbsp;further&nbsp;information,&nbsp;and&nbsp;sorry&nbsp;for&nbsp;missing&nbsp;"&nbsp;my&nbsp;own&nbsp;co-ordinate’s&nbsp;because&nbsp;it&nbsp;is&nbsp;for&nbsp;google&nbsp;map"&nbsp;in&nbsp;your&nbsp;statment,&nbsp;from&nbsp;this&nbsp;statement&nbsp;your&nbsp;maker&nbsp;srcProj&nbsp;should&nbsp;be&nbsp;OpenLayers.Projection(‘EPSG:3857’),&nbsp;and&nbsp;the&nbsp;desProj&nbsp;should&nbsp;be&nbsp;OpenLayers.Projection(‘EPSG:4326’)(EPSG:4326&nbsp;is&nbsp;our&nbsp;default&nbsp;projection).&nbsp;So,&nbsp;the&nbsp;right&nbsp;code&nbsp;should&nbsp;be:&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;var&nbsp;point&nbsp;=&nbsp;new&nbsp;OpenLayers.Geometry.Point(x,&nbsp;y);&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;srcProj&nbsp;=&nbsp;new&nbsp;OpenLayers.Projection(‘EPSG:3857’);&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;desProj&nbsp;=&nbsp;new&nbsp;OpenLayers.Projection(‘EPSG:4326’);&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;newPoint&nbsp;=&nbsp;OpenLayers.Projection.transform(point,&nbsp;srcProj,&nbsp;desProj);&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;newX&nbsp;=&nbsp;newPoint.x;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;newY&nbsp;=&nbsp;newPoint.y;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Map1.panToWorldCoordinate(newX,&nbsp;newY);&nbsp;  
&nbsp;&nbsp;  
&nbsp;Would&nbsp;you&nbsp;please&nbsp;try&nbsp;it&nbsp;again?&nbsp;And&nbsp;if&nbsp;the&nbsp;marker&nbsp;still&nbsp;don’t&nbsp;show,&nbsp;would&nbsp;you&nbsp;please&nbsp;give&nbsp;the&nbsp;marker’s&nbsp;coordinate?&nbsp;we&nbsp;will&nbsp;make&nbsp;a&nbsp;small&nbsp;sample&nbsp;for&nbsp;you.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Waiting&nbsp;for&nbsp;your&nbsp;furhter&nbsp;information.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Summer

---

<div class="post-metadata">

**Author:** ![Yogesh](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/y/49beb7/32.png) [@Yogesh](https://community.thinkgeo.com/u/Yogesh)\
**Post date:** [August 22, 2013, 4:30am UTC](https://community.thinkgeo.com/t/how-can-i-convert-x-y-co-ordinate-to-degree-decimal/4080/7 "2013-08-22T04:30:05Z")

</div>

Hi&nbsp;Summer,  
  
  
  
I&nbsp;try&nbsp;your&nbsp;code,  
  
Coordinate&nbsp;is&nbsp;change&nbsp;but&nbsp;still&nbsp;I&nbsp;don’t&nbsp;get&nbsp;marker&nbsp;to&nbsp;perfect&nbsp;place.  
  
  
  
My&nbsp;Marker&nbsp;Coordinate&nbsp;is:  
  
X:&nbsp;229425.8125  
  
Y:&nbsp;7575127.5  
  
  
  
This&nbsp;is&nbsp;in&nbsp;UTM&nbsp;Format.  
  
  
  
If&nbsp;I&nbsp;try&nbsp;this&nbsp;coordinate&nbsp;in&nbsp;Google&nbsp;Map&nbsp;so&nbsp;that&nbsp;time&nbsp;it&nbsp;show&nbsp;me&nbsp;perfect&nbsp;place&nbsp;but&nbsp;in&nbsp;my&nbsp;project  
  
this&nbsp;Coordinate&nbsp;is&nbsp;not&nbsp;work&nbsp;I&nbsp;mean&nbsp;in&nbsp;my&nbsp;project&nbsp;this&nbsp;coordinates&nbsp;show&nbsp;me&nbsp;different&nbsp;location.  
  
  
  
In&nbsp;my&nbsp;Project&nbsp;when&nbsp;I&nbsp;hover&nbsp;the&nbsp;mouse&nbsp;to&nbsp;the&nbsp;place&nbsp;where&nbsp;I&nbsp;want&nbsp;marker&nbsp;so&nbsp;it&nbsp;show&nbsp;me:  
  
-5301084.63677,&nbsp;-2500736.94520&nbsp;this&nbsp;coordinate&nbsp;while&nbsp;in&nbsp;my&nbsp;database&nbsp;Coordinate&nbsp;of&nbsp;that&nbsp;place&nbsp;is&nbsp;mention&nbsp;as&nbsp;above&nbsp;X&nbsp;and&nbsp;Y.

---

<div class="post-metadata">

**Author:** ![Summer1](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/s/c89c15/32.png) [@Summer1](https://community.thinkgeo.com/u/Summer1)\
**Post date:** [August 23, 2013, 2:12am UTC](https://community.thinkgeo.com/t/how-can-i-convert-x-y-co-ordinate-to-degree-decimal/4080/8 "2013-08-23T02:12:00Z")

</div>

Hi&nbsp;Yogesh,  
  
  
  
Thanks&nbsp;for&nbsp;your&nbsp;data,&nbsp;attached&nbsp;is&nbsp;our&nbsp;test&nbsp;sample&nbsp;on&nbsp;our&nbsp;end,&nbsp;and&nbsp;here&nbsp;is&nbsp;a&nbsp;guiding&nbsp;test&nbsp;vedio&nbsp;for&nbsp;you:&nbsp;screencast.com/t/YgQ2xupOoE3t  
  
  
  
Hope&nbsp;ie&nbsp;helps  
  
  
  
Summer  
  
[TransformSample.zip](https://community.thinkgeo.com/uploads/default/original/2X/c/c5c1d1f284c03dcf3ffaf52ae413b82da3690224.zip) (1.49 MB)

---

<div class="post-metadata">

**Author:** ![Yogesh](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/y/49beb7/32.png) [@Yogesh](https://community.thinkgeo.com/u/Yogesh)\
**Post date:** [August 23, 2013, 4:33am UTC](https://community.thinkgeo.com/t/how-can-i-convert-x-y-co-ordinate-to-degree-decimal/4080/9 "2013-08-23T04:33:15Z")

</div>

Hi,&nbsp;summer  
  
  
  
Thanks&nbsp;for&nbsp;giving&nbsp;this&nbsp;example&nbsp;can&nbsp;you&nbsp;please&nbsp;give&nbsp;this&nbsp;example&nbsp;in&nbsp;MapsuiteMVC&nbsp;application.&nbsp;Because,&nbsp;my&nbsp;application&nbsp;is&nbsp;in&nbsp;MVC&nbsp;3&nbsp;application  
  
  
  
Thanks&nbsp;&&nbsp;Regards,

---

<div class="post-metadata">

**Author:** ![Summer1](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/s/c89c15/32.png) [@Summer1](https://community.thinkgeo.com/u/Summer1)\
**Post date:** [August 25, 2013, 10:34pm UTC](https://community.thinkgeo.com/t/how-can-i-convert-x-y-co-ordinate-to-degree-decimal/4080/10 "2013-08-25T22:34:47Z")

</div>

Hi&nbsp;Yogesh,  
  
  
  
here&nbsp;is&nbsp;the&nbsp;mvc&nbsp;sample.  
  
  
  
if&nbsp;you&nbsp;have&nbsp;any&nbsp;more&nbsp;question&nbsp;,&nbsp;please&nbsp;feel&nbsp;free&nbsp;to&nbsp;let&nbsp;us&nbsp;know.  
  
  
  
Best&nbsp;Regards  
  
  
  
  
  
  
Summer  
  
[MVCSample.zip](https://community.thinkgeo.com/uploads/default/original/2X/e/ee92d84ff93ec00884dc3f6c8d45f90a96279d2c.zip) (1.62 MB)

---

<div class="post-metadata">

**Author:** ![Yogesh](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/y/49beb7/32.png) [@Yogesh](https://community.thinkgeo.com/u/Yogesh)\
**Post date:** [August 27, 2013, 12:51am UTC](https://community.thinkgeo.com/t/how-can-i-convert-x-y-co-ordinate-to-degree-decimal/4080/11 "2013-08-27T00:51:34Z")

</div>

Thankx&nbsp;for&nbsp;help  
  
Thank&nbsp;You&nbsp;Summer

---

<div class="post-metadata">

**Author:** ![Summer1](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/s/c89c15/32.png) [@Summer1](https://community.thinkgeo.com/u/Summer1)\
**Post date:** [August 27, 2013, 10:07pm UTC](https://community.thinkgeo.com/t/how-can-i-convert-x-y-co-ordinate-to-degree-decimal/4080/12 "2013-08-27T22:07:51Z")

</div>

Hi&nbsp;Yogesh,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Great&nbsp;to&nbsp;hear&nbsp;it&nbsp;helped,&nbsp;if&nbsp;you&nbsp;have&nbsp;any&nbsp;more&nbsp;question,&nbsp;please&nbsp;feel&nbsp;free&nbsp;to&nbsp;let&nbsp;us&nbsp;know.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Best&nbsp;Regards&nbsp;  
&nbsp;&nbsp;  
&nbsp;Summer

---

<div class="post-metadata">

**Author:** ![Ankit\_Singh](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/a/a88e4f/32.png) [@Ankit\_Singh](https://community.thinkgeo.com/u/Ankit_Singh)\
**Post date:** [May 5, 2018, 6:31am UTC](https://community.thinkgeo.com/t/how-can-i-convert-x-y-co-ordinate-to-degree-decimal/4080/13 "2018-05-05T06:31:32Z")

</div>

I want to catch coordinates from map like these Dallas(32.776664,-96.796988) and my code is…

private Location ProjectLocation(Location location)  
{  
Proj4Projection prj4 = new Proj4Projection();  
(Edit)prj4.InternalProjectionParametersString = Proj4Projection.GetGoogleMapsParametersString();  
prj4.ExternalProjectionParametersString = Proj4Projection.GetEpsgParametersString(4326);  
prj4.Open();  
PointShape projectedPoint = prj4.ConvertToExternalProjection(new PointShape(location.Longitude, location.Latitude)) as PointShape;

```
        Location projectedLocation = new Location();
        projectedLocation.Longitude = Math.Round(projectedPoint.X, 6);
        projectedLocation.Latitude = Math.Round(projectedPoint.Y, 6);
        return location;
    }

```

What changes should I make…Please help

---

<div class="post-metadata">

**Author:** ![Ethan](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/ethan/32/19964_2.png) [@Ethan](https://community.thinkgeo.com/u/Ethan)\
**Post date:** [May 7, 2018, 6:23am UTC](https://community.thinkgeo.com/t/how-can-i-convert-x-y-co-ordinate-to-degree-decimal/4080/14 "2018-05-07T06:23:28Z")

</div>

Hi Ankit\_Singh,

Your code convert location(wgs84) to decimal degree, so what’s the detail question here?

Regards,

Ethan

---

<div class="post-metadata">

**Author:** ![Ankit\_Singh](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/a/a88e4f/32.png) [@Ankit\_Singh](https://community.thinkgeo.com/u/Ankit_Singh)\
**Post date:** [May 7, 2018, 6:39am UTC](https://community.thinkgeo.com/t/how-can-i-convert-x-y-co-ordinate-to-degree-decimal/4080/15 "2018-05-07T06:39:50Z")

</div>

Hi Ethan…  
So in my project i am using a database which stores location in x,y coordinates to display on map…  
Through the above procedure they are correctly displayed as x,y coordinates…  
But my team requires me to store normal lat long coordinates in database(degree decimal)…like 32.776664,-96.796988…but through this code it fails to display such coordinates.  
So,what changes should i do…?  
Thanks

---

<div class="post-metadata">

**Author:** ![Ethan](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/ethan/32/19964_2.png) [@Ethan](https://community.thinkgeo.com/u/Ethan)\
**Post date:** [May 7, 2018, 9:55am UTC](https://community.thinkgeo.com/t/how-can-i-convert-x-y-co-ordinate-to-degree-decimal/4080/16 "2018-05-07T09:55:51Z")

</div>

Hi Ankit\_Singh,

In fact I still have a little confused about your question.

Please let me know if I misunderstand your question here:

1. Your database save the meter coordinate before and it works well
2. Now you want to change the data to decimal degree coordinate and you still want to show it correct

Does it right?

If that’s true, that means your original MapUnit is DecimalDegree, so you don’t need do reprojection now, jure remove the projection related code, and directly render the data should be works.

If you think the text is hard to describe your question please build a simple sample and upload it here, here is the guide about that: [http://wiki.thinkgeo.com/wiki/map\_suite\_project\_template\_guide](http://wiki.thinkgeo.com/wiki/map_suite_project_template_guide)

Regards,

Ethan

---

<div class="post-metadata">

**Author:** ![Ankit\_Singh](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/a/a88e4f/32.png) [@Ankit\_Singh](https://community.thinkgeo.com/u/Ankit_Singh)\
**Post date:** [May 7, 2018, 10:31am UTC](https://community.thinkgeo.com/t/how-can-i-convert-x-y-co-ordinate-to-degree-decimal/4080/17 "2018-05-07T10:31:46Z")

</div>

Actually I am not much familiar with the coordinate system…  
Simply…I have these coordinates in my database (8149809.385,2547105.881) which are displayed correctly but i want to use (23.196685,72.631305) and through the code i have these are displayed on the equator as (0,0)

---

<div class="post-metadata">

**Author:** ![Ethan](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/ethan/32/19964_2.png) [@Ethan](https://community.thinkgeo.com/u/Ethan)\
**Post date:** [May 8, 2018, 5:46am UTC](https://community.thinkgeo.com/t/how-can-i-convert-x-y-co-ordinate-to-degree-decimal/4080/18 "2018-05-08T05:46:47Z")

</div>

Hi Ankit\_Singh,

Thanks for your sample, I see your question.

The code as below should works for your scenario:

```
PointShape pointInDatabaseNow = new PointShape(23.196685, 72.631305);

Proj4Projection prj4 = new Proj4Projection();
prj4.InternalProjectionParametersString = Proj4Projection.GetDecimalDegreesParametersString();
prj4.ExternalProjectionParametersString = Proj4Projection.GetGoogleMapParametersString();
prj4.Open();
PointShape pointOnMapNow = prj4.ConvertToExternalProjection(pointInDatabaseNow) as PointShape; // It should be the format like 8149809.385,2547105.881

```

Wish that’s helpful.

Regards,

Ethan
