MapPoint Forums

MapForums

Community of MapPoint and Virtual Earth Users and Developers




Getting the coordinates from a freeform shape

This is a discussion on Getting the coordinates from a freeform shape within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Is it possible to extract the coordinates of a users drawn freeform shape? Today I'm cheating, saving the map, and ...


Go Back   MapPoint Forums > Map Forums > MapPoint 2006/2009 Discussion

Today's Posts Twitter Feed Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read



Click here to register

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-11-2005
pst pst is offline
Junior Member
White Belt
 
Join Date: Jul 2005
Posts: 5
Getting the coordinates from a freeform shape

Is it possible to extract the coordinates of a users drawn freeform shape?

Today I'm cheating, saving the map, and using a modified version of st2gpx to read back the coordinates.

There must be a "cleaner" solution.

(Using MFC/C++)

/Patrik
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 07-11-2005
Eric Frost's Avatar
Senior Member
Black Belt
 
Join Date: Jul 1992
Posts: 3,041
Blog Entries: 2
Check out this code sample --

http://www.mp2kmag.com/importersub01.asp

This loops around all the vertices of a freeform and exports to a mif/mid. You should be able to make this work for you.

Eric
__________________
~ Now taking orders for MapPoint 2009 ~
~~
~ Upgrade to MapForums Plus membership ~
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 07-13-2005
pst pst is offline
Junior Member
White Belt
 
Join Date: Jul 2005
Posts: 5
I've been looking into that sample, but I have some problems translating the code to c++.

The real problem is that I can't seem to retreive the "Location objects" from the Shapes Vertices.

I use something like this:
Code:
	CMap0 m=m_Map.get_ActiveMap();
	CShapes myShapes=m.get_Shapes();
	long ns=myShapes.get_Count();
	if(ns>0)
	{
		VARIANT a; a.vt=VT_I4; a.lVal=1;

 		CShape myShape=myShapes.get_Item(&a);
		VARIANT v_coords=myShape.get_Vertices();

		??? HOWTO extract the CLocation objects from the Vertices array ???
	}
Any code samples available?

/Patrik
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 07-13-2005
Winwaed's Avatar
Mapping-Tools.com
Black Belt
 
Join Date: Feb 2004
Posts: 1,142
Blog Entries: 22
I'm not sure if it helps or not, but I have done the opposite (putting coords in shapes) in C++ in the following article:

http://www.mp2kmag.com/a113--plottin....mappoint.html

Note that I don't use MFC.


Richard
__________________
Winwaed Software Technology LLC
http://www.winwaed.com
See http://www.mapping-tools.com for MapPoint Tools
See the Geoweb Guru for online mapping
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5 (permalink)  
Old 07-13-2005
pst pst is offline
Junior Member
White Belt
 
Join Date: Jul 2005
Posts: 5
After some trial & error coding with MFC variants and arrays, I finally got it working.

See below for a code sample.

/Patrik

Code:
void dlgZoneEdit::OnBnClickedShape()
{
	CMap0 m=m_Map.get_ActiveMap();
	CShapes myShapes=m.get_Shapes();
	long ns=myShapes.get_Count();
	if(ns>0)
	{
		VARIANT a; a.vt=VT_I4; a.lVal=1;

 		CShape myShape=myShapes.get_Item(&a);
		VARIANT v_coords=myShape.get_Vertices();
		COleSafeArray saRet(&v_coords);

    long iPoints;
    saRet.GetUBound(1, &iPoints);

		long index[1];
		for(int i=0;i<=iPoints;i++)
		{
			index[0]=i;
			COleVariant vData;
			saRet.GetElement(index,vData);
			
			double lat,lon;
			CLocation cl(vData.pdispVal);
			GetPos(m,cl,&lat,&lon);
		}
	}
}
[/code]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6 (permalink)  
Old 07-14-2005
Eric Frost's Avatar
Senior Member
Black Belt
 
Join Date: Jul 1992
Posts: 3,041
Blog Entries: 2
Thanks for sharing.
__________________
~ Now taking orders for MapPoint 2009 ~
~~
~ Upgrade to MapForums Plus membership ~
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
coordinates, freeform, shape


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

Thread Thread Starter Forum Replies Last Post
Shape coordinates MarkStanley MapPoint 2006/2009 Discussion 13 03-04-2007 03:57 AM
Start Draw shape (freeform) Anonymous MapPoint 2006/2009 Discussion 2 10-24-2006 06:37 PM
freeform shape exporting.. database maybe? Yard MapPoint 2006/2009 Discussion 3 07-25-2003 08:22 AM
View bounds of a Freeform Shape Anonymous MapPoint 2006/2009 Discussion 0 04-29-2003 05:35 PM
How can I locate the position of a freeform shape .... Anonymous MapPoint 2006/2009 Discussion 4 07-31-2002 01:45 PM


All times are GMT -5. The time now is 04:51 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0 RC2
MP2K Magazine
Visitor Map

Costa Brava Holiday
Beautiful kilometres of sandy beaches await you should you choose a Costa Brava holiday through UlookUbook!



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59