MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




MapPoint to Gif Programatically

This is a discussion on MapPoint to Gif Programatically within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; I am creating a series of gif files based upon location information that I feed to Map Point. I use ...


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

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 02-20-2003
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
MapPoint to Gif Programatically

I am creating a series of gif files based upon location information that I feed to Map Point. I use the 'Save As' method to push the map into an HtML. I grab the image and push it into an Image Object. Then I repeat the routine. And something is holding on to the image. The Map Point Application has been cleaned up as well as the ancillary objects I use (Map, Location, PushPin), etc. Is there something I am missing?
It goes something like this:

objMapApp = new mappoint.application
objMap = Find(some criteria)
objMap.SaveAs(htmlpath,saveashtml)
objImage = Image.fromFile(imagepath & "image_map.gif")
objMapApp.quite
objMapApp = nothing

This works fine until I repeat the process... then nothing can touch that image file (no system.io operations, no MapPoint.SaveAs)

Any thoughts?
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 02-20-2003
John Meyer's Avatar
Senior Member
Blue Belt
 
Join Date: Jul 2002
Posts: 479
Have you ruled out this FromFile Method part of the code?
Code:
objImage = Image.fromFile(imagepath & "image_map.gif")
__________________
John
http://www.support-pc.com

Order MapPoint 2006 Here
https://secure.mp2kmag.com/?refer=support-PC
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 02-20-2003
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Yes, I have.

Right now, I'm getting around it by generating a random file name for each new html I create. And everything is being created correctly.
But I still can't clean up the files until I leave my application.

Somewhere, something in MapPoint isn't being cleaned up correctly, but I think my code cleans everything possible. But either I am wrong, or the mere reference to MapPoint creates some type of wrapper that runs along with my application, or I have no idea what is going on.

Smile.
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 04-14-2003
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Or you could use a picture object (untested code).

Code:
    Dim mpUtil As New MapPointUtilities.MapPointUtilities
    Dim pict As StdPicture
    Set pict = mpUtil.GetPictureFromObject(mpApp.ActiveMap)
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 03-10-2004
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Doingit in VB.NET

If you want to do it in VB.NET you might run in to trouble (as I did), so here's what you do there:

Add a class to your project (remember to add a reference to stdole):
Code:
Public Class ConvertImage
    Inherits System.Windows.Forms.AxHost
    Public Sub New()
        MyBase.New("59EE46BA-677D-4d20-BF10-8D8067CB8B33")
    End Sub

    Public Shared Function ImageToIPicture(ByVal Image As System.Drawing.Image) As stdole.IPictureDisp
        ImageToIPicture = GetIPictureFromPicture(Image)
    End Function

    Public Shared Function IPictureToImage(ByVal Image As stdole.IPictureDisp) As System.Drawing.Image
        IPictureToImage = GetPictureFromIPicture(Image)
    End Function
End Class
And then call the code as this (having an imagebox on your form called Picture1):
Code:
        Picture1.Image = ConvertImage.IPictureToImage(mpUtil.GetPictureFromObject(mpApp.ActiveMap))
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 03-17-2004
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
have you tried to sleep a few seconds between the two saves? I have found that this helps to sometimes solve weird MP behaviour.
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
gif, mappoint, programatically


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
Rotate map programatically in MapPoint 2006 Banu MapPoint 2006/2009 Discussion 0 05-04-2006 05:46 PM
Ctrl+T (Data -> Territories...) programatically MapPoint SheepWorrier MapPoint 2006/2009 Discussion 3 04-12-2005 05:34 PM
Can MapPoint programatically add a place (not a pushpin)? Anonymous MapPoint 2006/2009 Discussion 0 11-11-2003 11:39 AM
Error in programatically drawing radius rings in mappoint Eamon MapPoint 2006/2009 Discussion 1 01-02-2003 06:39 PM
Is MapPoint capable of programatically returning a.... Anonymous MapPoint 2006/2009 Discussion 1 07-18-2002 05:27 AM


All times are GMT -5. The time now is 10:40 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
MP2K Magazine
Visitor Map


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