# Map events and Projection convertion

**URL:** <https://community.thinkgeo.com/t/map-events-and-projection-convertion/306>\
**Category:** WinForms\
**Created:** [March 25, 2009, 1:49pm UTC](https://community.thinkgeo.com/t/map-events-and-projection-convertion/306 "2009-03-25T13:49:28Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rose](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/r/91b2a8/32.png) [@Rose](https://community.thinkgeo.com/u/Rose)\
**Post date:** [March 25, 2009, 1:49pm UTC](https://community.thinkgeo.com/t/map-events-and-projection-convertion/306/1 "2009-03-25T13:49:28Z")

</div>

Hi,

There&nbsp;are&nbsp;some&nbsp;map&nbsp;events&nbsp;like&nbsp;TrackLineDraw,&nbsp;TrackCircleDraw&nbsp;,&nbsp;SelectMapShapes&nbsp;&nbsp;etc&nbsp;in&nbsp;Map&nbsp;Suite&nbsp;2.0,&nbsp;can't&nbsp;find&nbsp;them&nbsp;in&nbsp;Map&nbsp;Suite&nbsp;3.0.&nbsp;Are&nbsp;they&nbsp;not&nbsp;supported&nbsp;any&nbsp;more?

When&nbsp;the&nbsp;mouse&nbsp;moves&nbsp;on&nbsp;the&nbsp;map,&nbsp;I&nbsp;want&nbsp;to&nbsp;display&nbsp;the&nbsp;world&nbsp;coordinates&nbsp;at&nbsp;the&nbsp;status&nbsp;bar,&nbsp;how&nbsp;to&nbsp;convert&nbsp;the&nbsp;screen&nbsp;coordinates&nbsp;to&nbsp;world&nbsp;coordinates?

In&nbsp;ver&nbsp;2.0,&nbsp;I&nbsp;created&nbsp;following&nbsp;class&nbsp;to&nbsp;convert&nbsp;the&nbsp;Geodetic&nbsp;projection&nbsp;coordinates&nbsp;to&nbsp;Mercator&nbsp;projection,&nbsp;&nbsp;how&nbsp;to&nbsp;do&nbsp;this&nbsp;in&nbsp;version&nbsp;3.0?

&nbsp;

&nbsp;

Class&nbsp;GeodeticToMercatorImplements&nbsp;IProjection&nbsp;'''&nbsp;  
X-coordinate

&nbsp;

'''&nbsp;  
Y-coordinate

&nbsp;

'''&nbsp;\<returns\>\</returns\>After&nbsp;transformation&nbsp;coordinate

&nbsp;

&nbsp;

Public&nbsp;Function&nbsp;ProjectPoint(ByVal&nbsp;X&nbsp;As&nbsp;Double,&nbsp;ByVal&nbsp;Y&nbsp;As&nbsp;Double)&nbsp;As&nbsp;PointR&nbsp;Implements&nbsp;IProjection.ProjectPoint'&nbsp;Create&nbsp;a&nbsp;MollweidProj.

&nbsp;

&nbsp;

&nbsp;

&nbsp;

Dim&nbsp;MercatorProj&nbsp;As&nbsp;MercatorProj&nbsp;=&nbsp;New&nbsp;MercatorProj()Dim&nbsp;Easting&nbsp;As&nbsp;Double&nbsp;=&nbsp;0Dim&nbsp;Northing&nbsp;As&nbsp;Double&nbsp;=&nbsp;0'&nbsp;Convert.

MercatorProj.ConvertGeodeticToMercator(Y,&nbsp;X,&nbsp;Easting,&nbsp;Northing)

ProjectPoint&nbsp;=

&nbsp;

End

New&nbsp;PointR(Easting,&nbsp;Northing)End&nbsp;Function&nbsp;Class

&nbsp;

&nbsp;

&nbsp;

&nbsp;

Public

---

<div class="post-metadata">

**Author:** ![Ben](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/ben/32/25720_2.png) [@Ben](https://community.thinkgeo.com/u/Ben)\
**Post date:** [March 25, 2009, 10:15pm UTC](https://community.thinkgeo.com/t/map-events-and-projection-convertion/306/2 "2009-03-25T22:15:26Z")

</div>

Rose,&nbsp;  
  
  
  
We&nbsp;don't&nbsp;have&nbsp;the&nbsp;similar&nbsp;events&nbsp;to&nbsp;TrackLineDraw&nbsp;or&nbsp;TrackCircleDraw&nbsp;in&nbsp;current&nbsp;3.0&nbsp;Beta.&nbsp;You&nbsp;need&nbsp;to&nbsp;implement&nbsp;it&nbsp;yourself&nbsp;by&nbsp;overwriting&nbsp;the&nbsp;MouseMove&nbsp;event.&nbsp;We&nbsp;don't&nbsp;have&nbsp;the&nbsp;similar&nbsp;one&nbsp;for&nbsp;SelectMapShapes&nbsp;also,&nbsp;as&nbsp;we&nbsp;don't&nbsp;have&nbsp;MapShapes&nbsp;in&nbsp;3.0&nbsp;any&nbsp;more.&nbsp;You&nbsp;can&nbsp;still&nbsp;implement&nbsp;this&nbsp;function&nbsp;by&nbsp;overwriting&nbsp;the&nbsp;Mouse&nbsp;Click&nbsp;event&nbsp;and&nbsp;get&nbsp;the&nbsp;nearest&nbsp;shape&nbsp;through&nbsp;spatial&nbsp;query.&nbsp;By&nbsp;the&nbsp;way,&nbsp;in&nbsp;3.0,&nbsp;you&nbsp;need&nbsp;to&nbsp;change&nbsp;the&nbsp;track&nbsp;mode&nbsp;in&nbsp;EditOverlay.&nbsp;For&nbsp;example,&nbsp;here&nbsp;is&nbsp;how&nbsp;to&nbsp;set&nbsp;the&nbsp;map&nbsp;to&nbsp;TrackCircle&nbsp;mode.&nbsp;  
  
`winformsMap1.EditOverlay.TrackMode = TrackMode.Circle`  
We&nbsp;have&nbsp;a&nbsp;static&nbsp;class&nbsp;ExtentHelper&nbsp;for&nbsp;all&nbsp;the&nbsp;coordinate&nbsp;transformation&nbsp;stuff.&nbsp;You&nbsp;can&nbsp;use&nbsp;ExtentHelper.ToWorldCoordinate()&nbsp;to&nbsp;change&nbsp;a&nbsp;screen&nbsp;coordinate&nbsp;to&nbsp;a&nbsp;world&nbsp;coordinate.&nbsp;Check&nbsp;ExtentHelper&nbsp;for&nbsp;more&nbsp;transformation&nbsp;methods.&nbsp;  
  
  
  
Projection&nbsp;part&nbsp;changes&nbsp;a&nbsp;lot&nbsp;from&nbsp;2.0.&nbsp;Now&nbsp;we&nbsp;are&nbsp;using&nbsp;the&nbsp;Srid&nbsp;number&nbsp;to&nbsp;do&nbsp;the&nbsp;projection&nbsp;conversion.&nbsp;So&nbsp;for&nbsp;example,&nbsp;you&nbsp;want&nbsp;to&nbsp;show&nbsp;a&nbsp;Geodetic&nbsp;layer&nbsp;within&nbsp;Mercator&nbsp;projection,&nbsp;here&nbsp;is&nbsp;you&nbsp;need&nbsp;to&nbsp;do.&nbsp;&nbsp;  
  
1,&nbsp;Check&nbsp;the&nbsp;Srid&nbsp;number&nbsp;for&nbsp;both&nbsp;Geodetic&nbsp;and&nbsp;Mercator.&nbsp;&nbsp;Geodetic&nbsp;is&nbsp;4326,&nbsp;for&nbsp;Mercator&nbsp;please&nbsp;check&nbsp;it&nbsp;in&nbsp;the&nbsp;documentation&nbsp;(C:\Program&nbsp;Files\ThinkGeo\Map&nbsp;Suite&nbsp;Desktop&nbsp;Evaluation&nbsp;Edition&nbsp;3.0&nbsp;(BETA)\Documentation\Projections)&nbsp;.&nbsp;For&nbsp;example,&nbsp;in&nbsp;EPSG.rtf,&nbsp;I&nbsp;found&nbsp;the&nbsp;“New&nbsp;Zealand&nbsp;Transverse&nbsp;Mercator”&nbsp;with&nbsp;the&nbsp;Srid&nbsp;1229.&nbsp;  
  
2,&nbsp;Create&nbsp;a&nbsp;Proj4Projection&nbsp;object&nbsp;with&nbsp;the&nbsp;2&nbsp;srid&nbsp;numbers.&nbsp;  
  
`Proj4Projection proj4 = new Proj4Projection(4326, 1229)`  
3,&nbsp;Set&nbsp;the&nbsp;proj4&nbsp;project&nbsp;to&nbsp;layer.FeatureSource,&nbsp;don't&nbsp;forget&nbsp;to&nbsp;set&nbsp;the&nbsp;map's&nbsp;current&nbsp;extent.&nbsp;Code&nbsp;will&nbsp;be&nbsp;like&nbsp;this.&nbsp;  
  
`Dim proj4 As New Proj4Projection(4326, 1229)newZealandLayer.FeatureSource.Projection = proj4newZealandLayer.Open()winformsMap1.CurrentExtent = newZealandLayer.GetBoundingBox()newZealandLayer.Close()`  
Also,&nbsp;you&nbsp;can&nbsp;create&nbsp;your&nbsp;projection&nbsp;by&nbsp;inheriting&nbsp;the&nbsp;“Projection”&nbsp;class&nbsp;and&nbsp;override&nbsp;a&nbsp;couple&nbsp;methods,&nbsp;just&nbsp;like&nbsp;what&nbsp;need&nbsp;to&nbsp;do&nbsp;in&nbsp;2.0.&nbsp;You&nbsp;can&nbsp;even&nbsp;use&nbsp;the&nbsp;2.0&nbsp;projection&nbsp;objects&nbsp;by&nbsp;referencing&nbsp;the&nbsp;MapSuiteCommon.dll.&nbsp;  
  
  
  
Let&nbsp;me&nbsp;know&nbsp;for&nbsp;more&nbsp;queries.&nbsp;  
  
  
  
Thanks,&nbsp;  
  
  
  
Ben

---

<div class="post-metadata">

**Author:** ![Rose](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/r/91b2a8/32.png) [@Rose](https://community.thinkgeo.com/u/Rose)\
**Post date:** [March 26, 2009, 9:07am UTC](https://community.thinkgeo.com/t/map-events-and-projection-convertion/306/3 "2009-03-26T09:07:49Z")

</div>

Ben:

Thank&nbsp;you&nbsp;for&nbsp;all&nbsp;your&nbsp;replies!&nbsp;They&nbsp;help&nbsp;me&nbsp;a&nbsp;lot.&nbsp;I&nbsp;am&nbsp;moving&nbsp;forward&nbsp;on&nbsp;the&nbsp;way&nbsp;to&nbsp;upgrade&nbsp;to&nbsp;Map&nbsp;Suite&nbsp;ver.&nbsp;3.0!

Do&nbsp;you&nbsp;have&nbsp;any&nbsp;examples&nbsp;that&nbsp;implement&nbsp;the&nbsp;TrackLineDraw&nbsp;event&nbsp;&nbsp;in&nbsp;ver&nbsp;3.0.&nbsp;&nbsp;After&nbsp;I&nbsp;set&nbsp;the&nbsp;&nbsp;EditOverlay.TrackMode&nbsp;to&nbsp;TrackModel.Line,&nbsp;I&nbsp;can&nbsp;see&nbsp;the&nbsp;line&nbsp;is&nbsp;drawn&nbsp;on&nbsp;the&nbsp;map.&nbsp;How&nbsp;&nbsp;to&nbsp;retrieve&nbsp;the&nbsp;line&nbsp;geometry&nbsp;information&nbsp;and&nbsp;save&nbsp;it&nbsp;in&nbsp;a&nbsp;LineShape,&nbsp;so&nbsp;I&nbsp;can&nbsp;do&nbsp;other&nbsp;spatial&nbsp;operations&nbsp;using&nbsp;the&nbsp;LineShape&nbsp;with&nbsp;other&nbsp;features&nbsp;in&nbsp;my&nbsp;Feature&nbsp;Layer?&nbsp;One&nbsp;of&nbsp;the&nbsp;reasons&nbsp;we&nbsp;chose&nbsp;Map&nbsp;Suite&nbsp;Desktop&nbsp;instead&nbsp;of&nbsp;Map&nbsp;Suite&nbsp;Engine&nbsp;is&nbsp;that&nbsp;the&nbsp;Desktop&nbsp;has&nbsp;more&nbsp;ready-to-use&nbsp;features&nbsp;than&nbsp;the&nbsp;Engine,&nbsp;we&nbsp;don't&nbsp;have&nbsp;to&nbsp;implement&nbsp;ourselves

Thanks

Rose

&nbsp;

&nbsp;

---

<div class="post-metadata">

**Author:** ![Ben](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/ben/32/25720_2.png) [@Ben](https://community.thinkgeo.com/u/Ben)\
**Post date:** [March 27, 2009, 12:40am UTC](https://community.thinkgeo.com/t/map-events-and-projection-convertion/306/4 "2009-03-27T00:40:40Z")

</div>

Rose,&nbsp;  
&nbsp;&nbsp;  
&nbsp;After&nbsp;tracking&nbsp;lines&nbsp;on&nbsp;the&nbsp;map,&nbsp;the&nbsp;drawn&nbsp;lines&nbsp;will&nbsp;be&nbsp;saved&nbsp;to&nbsp;  
&nbsp;&nbsp;winformsMap1.EditOverlay.EditLayer&nbsp;&nbsp;  
&nbsp;which&nbsp;is&nbsp;an&nbsp;InMemoryFeatureLayer&nbsp;and&nbsp;you&nbsp;can&nbsp;easily&nbsp;get&nbsp;all&nbsp;the&nbsp;features&nbsp;through&nbsp;&nbsp;winformsMap1.EditOverlay.EditLayer.InternalFeatures.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Ben

---

<div class="post-metadata">

**Author:** ![Ted](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/t/db5fbb/32.png) [@Ted](https://community.thinkgeo.com/u/Ted)\
**Post date:** [March 27, 2009, 4:30am UTC](https://community.thinkgeo.com/t/map-events-and-projection-convertion/306/5 "2009-03-27T04:30:51Z")

</div>

I&nbsp;see&nbsp;I&nbsp;started&nbsp;another&nbsp;thread&nbsp;with&nbsp;this&nbsp;exact&nbsp;question...&nbsp;what&nbsp;event&nbsp;gets&nbsp;elevated&nbsp;when&nbsp;the&nbsp;user&nbsp;double-clicks&nbsp;to&nbsp;end&nbsp;the&nbsp;line&nbsp;or&nbsp;polygon&nbsp;drawing?&nbsp;&nbsp;&nbsp;&nbsp;If&nbsp;we&nbsp;know&nbsp;that&nbsp;event,&nbsp;we&nbsp;can&nbsp;go&nbsp;get&nbsp;the&nbsp;user-drawn&nbsp;features.

---

<div class="post-metadata">

**Author:** ![David](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/d/aeb1de/32.png) [@David](https://community.thinkgeo.com/u/David)\
**Post date:** [April 2, 2009, 10:42am UTC](https://community.thinkgeo.com/t/map-events-and-projection-convertion/306/6 "2009-04-02T10:42:18Z")

</div>

Ted,&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;I&nbsp;hope&nbsp;to&nbsp;have&nbsp;a&nbsp;dll&nbsp;pack&nbsp;for&nbsp;you&nbsp;tomorrow&nbsp;for&nbsp;this.&nbsp;&nbsp;Note&nbsp;that&nbsp;this&nbsp;will&nbsp;be&nbsp;an&nbsp;interim&nbsp;build&nbsp;and&nbsp;not&nbsp;an&nbsp;official&nbsp;release.&nbsp;  
&nbsp;&nbsp;  
&nbsp;David

---

<div class="post-metadata">

**Author:** ![Rose](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/r/91b2a8/32.png) [@Rose](https://community.thinkgeo.com/u/Rose)\
**Post date:** [April 6, 2009, 9:38am UTC](https://community.thinkgeo.com/t/map-events-and-projection-convertion/306/7 "2009-04-06T09:38:46Z")

</div>

David:

Can&nbsp;I&nbsp;get&nbsp;the&nbsp;dll&nbsp;pack&nbsp;you&nbsp;mentioned&nbsp;above?

thx

Rose

&nbsp;

---

<div class="post-metadata">

**Author:** ![Ben](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/ben/32/25720_2.png) [@Ben](https://community.thinkgeo.com/u/Ben)\
**Post date:** [April 7, 2009, 3:29am UTC](https://community.thinkgeo.com/t/map-events-and-projection-convertion/306/8 "2009-04-07T03:29:02Z")

</div>

&nbsp;

Rose,

We&nbsp;will&nbsp;send&nbsp;the&nbsp;temporary&nbsp;package&nbsp;to&nbsp;you&nbsp;today&nbsp;or&nbsp;tomorrow&nbsp;by&nbsp;email.&nbsp;&nbsp;We&nbsp;will&nbsp;send&nbsp;it&nbsp;to&nbsp;the&nbsp;account&nbsp;you&nbsp;registered&nbsp;and&nbsp;please&nbsp;contact&nbsp;[support@thinkgeo.com](mailto:support@thinkgeo.com)if&nbsp;you&nbsp;have&nbsp;any&nbsp;issues.

&nbsp;

Thanks,

Ben
