spacer1
spacer2 1_1 1_2
2_1
 Subscribe
 The MP2K Update!
 
 
 
 Magazine
Front Cover
What's New
Articles
News
Sample Data
Gallery
Advertise
About
 Features
MapPoint 2013
Press Releases
MapPoint Forums
Companies
Link to MP2Kmag
Wish List
MapPoint Trial
Authors
 Earlier Content
Past News Items
Past What's New Announcements
 Sponsors
 Order

MapPoint 2013

Programming MapPoint in .NET

MapPoint Book

  Spatial Community
SVG Tutorials
MapPoint

Map Visitors

  MAPPOINT Q & A  

Top | Post New Question | Read All | MP2K Asks Microsoft

813 Sylvain - July 31, 2002

How can I locate the position of a freeform shape object so I can keep this information in a database and use it to reproduce the same shape and position when I need it?

Answers:
July 31, 2002
First you need to read/download the code written by Gilles Kohl "A More Compact Method for Obtaining Lat/Long " at

http://www.mp2kmag.com/articles.asp?ArticleID=13

cut/paste that code into a module. Make sure you have a reference to the Microsoft Mappoint 9.0 object Library(North America)

Assuming you have a shape on your map this code will give you a message box with the Lat/Long for the shape. Store them in you database. When you want to recreate the shape use the GetLocation method with your lat/long. Then use the addshape method. You will also need the size you want the shape to be so you might want to store that as well.

Public thelat As Double
Public thelon As Double
Private Sub Command1_Click()
Dim iShape As MapPointCtl.Shape
Set iShape = MappointControl1.ActiveMap.Shapes(1)

Dim themap As MapPoint.Map
Set themap = MappointControl1.ActiveMap
Dim theloc As MapPoint.Location
Set theloc = iShape.Location
CalcPos themap, theloc, thelat, thelon
MsgBox thelat & " , " & thelon
John
john@support-pc.com

August 1, 2002
Also, check out Walt's mif/mid exporter: http://www.mp2kmag.com/importersub01.asp. Whether you can MapInfo or not, this can still be useful as it exports text files, you can parse those to get the coordinates. It's compiled for you and linked from a past update: http://www.mp2kmag.com/update/?id=5 Look near the bottom. - Eric

August 1, 2002
Thanks John, the only problem I have is a freeform has no Location or a center point to start from. I also did not find a way of using the "Points" of the freeform. Sylvain

August 1, 2002
Use the vertices. Look in Walt's code (referenced above) to see how he accomplishes it.. or just use Walt's solution. - Eric

Post New Answer / Follow-up


Google
 
MP2Kmag Internet


 Recent Discussion
 Resources


Want Your Site To Appear Here?

   © 1999-2012 MP2K. Questions and comments to: website@mp2kmag.com
  Microsoft and MapPoint 2002/2004/2006/2009/2010/2011/2013 are either trademarks or registered trademarks of Microsoft.