PDA

View Full Version : Map.ptm increase size



marcick
08-14-2013, 05:27 AM
Hi everybody,
I have a VB2010 application that uses MappointControl to show a map (Mappoint2010 europe).
I have added this code to automatically save the map at exit, because I want that the graphics the user can add is preserved:

Mainform.MappointControl1.SaveMap()
MyMap.Saved = True
Mainform.MappointControl1.CloseMap()


The problem is that everytime the app is closed (and those code executed) the size of Map.ptm file (located in documents folder), grow of about 37Kb, WITHOUT anything has been added to the map.
That file starts at around 1200KB first time, then grow and grow and the loading becomes slower and slower.
I just start and close the app, without changing anything in the map, and the file is everytime 37Kb bigger.
Any idea ?
Marco

Eric Frost
08-14-2013, 10:06 AM
Hmm, that's crazy. I haven't heard of this issue.

I don't think it would be too hard to loop through all the drawing objects on the map and save them elsewhere, and re-render them on the map, thus eliminating the need to save to a PTM?

marcick
08-16-2013, 02:32 AM
Hmm, that's crazy. I haven't heard of this issue.

I don't think it would be too hard to loop through all the drawing objects on the map and save them elsewhere, and re-render them on the map, thus eliminating the need to save to a PTM?

Hi Eric, sorry for delay. Yes, that would be a solution, just wanted to see if anybody else experience this or not.
thank you
Marco

marcick
08-16-2013, 03:49 AM
mmmhhh ... it's a long time I don't put hands on this programming and I have some rust ....

I want to collect all pushpins placed on the map, but this poor attempt does not work.

Dim objpushpin As MapPoint.Pushpin
Dim aa As String
For Each objpushpin In MyMap.Shapes
aa = objpushpin.Name
Next

Any hints ?
Marco

Eric Frost
08-16-2013, 10:29 AM
Try this --



Dim ds As MapPoint.Dataset
Dim ds As MapPoint.Recordset

For Each ds in MyMap.Datasets
Set rs = ds.QueryAllRecords
rs.MoveFirst
Do While not rs.EOF
'do something with your record e.g.
Debug.Print rs.Pushpin.Location.Latitude, rs.Pushpin.Location.Longitude
rs.MoveNext
Loop
Next


I might be a little off with the syntax in the debug print line, but hopefully this is enough to get you started in the right direction!

The reason for the two loops is that there can be multiple "datasets" with Pushpins in a map. If you only ever have a single dataset on a map, you could get away with something like this.



Set ds = MyMap.Dataset(1)
Set rs = ds.QueryAllRecords
rs.MoveFirst
Do While not rs.EOF
'do something with your record e.g.
Debug.Print rs.Pushpin.Location.Latitude, rs.Pushpin.Location.Longitude
rs.MoveNext
Loop


Do you also have Shape objects on the map? i.e. Circles, Textboxes, Freeform lines, etc? or just Pushpins?

marcick
08-16-2013, 10:50 AM
Thanks Eric, I'll try it tomorrow.
I just have pushpins, when I retrieve name, comment and location, that's all !
MArco

marcick
08-19-2013, 02:01 AM
Hi, it works perfectly, thanks again
Marco

Eric Frost
08-19-2013, 11:12 AM
Great! Glad to help.
Eric