Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Results 1 to 7 of 7

Create gif file from mappoint

This is a discussion on Create gif file from mappoint within the MapPoint Desktop Discussion forums, part of the Map Forums category; Hello everybody, I'm using visual basic to create a gif file from an object location in mappoint. I successfully created ...

  1. #1
    giaarcix is offline Junior Member Yellow Belt
    Join Date
    May 2006
    Posts
    13

    Create gif file from mappoint

    Hello everybody,
    I'm using visual basic to create a gif file from an object location in mappoint.
    I successfully created my gif file by creating a temporary web page and then saving the related gif file.
    My problem is that this operation takes a lot of time. I would like to know if there is a way to create directly the gif file without creating the webpage. Thank you very much for any help!
    This is my source code:

    Private Sub create_gif(latitute As Double, longitude As Double)

    'INITIALIZATION OF MAPPOINT CONTROL
    Dim oMap As MapPointctl.Map
    Dim oWebPage As MapPointctl.SavedWebPage
    Dim objLoc As MapPointctl.Location
    MappointControl1.NewMap geoMapEurope

    'I CREATE A TEMPORARY WEB PAGE (THIS CREATES ALSO THE GIF FILE)
    Set oMap = MappointControl1.ActiveMap
    Set objLoc = oMap.GetLocation(latitute, longitude, 100)
    Set oWebPage = oMap.SavedWebPages.Add(filename:="c:\temp.htm", Location:=objLoc)
    oWebPage.Save

    'I SAVE THE GIF FILE SOMEWHERE IN MY COMPUTER
    FileCopy "c:\temp_files\image_map.gif", "c:\test.gif"

    'I DELETE THE TEMPORARY WEBPAGE
    Dim fso As FileSystemObject
    Set fso = New FileSystemObject
    fso.DeleteFolder "c:\temp_files", True
    Kill ("c:\temp.htm")

    End Sub
    Bisogna sognare, insistere, ripetere, finchŔ il sogno si trasformi in realtÓ

  2. #2
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433
    Hi,

    Use CopyMap method. this copies the map to Clipboard. Then you have control yourself on what to do with it as fast as possible.

  3. #3
    giaarcix is offline Junior Member Yellow Belt
    Join Date
    May 2006
    Posts
    13

    great... but there is another problem...

    Hello! Thank you very much: it worked fine and it takes much less time.
    This is the code I used:

    objLoc.GoTo
    Clipboard.Clear
    oMap.CopyMap
    SavePicture Clipboard.GetData(), "c:\temp.gif"

    The problem now is this: with the first (html) method I created a gif file with format 460x460 pixels that was about 30 or 40 kbytes.
    With the second method (clipboard) the same gif becomes about 600 kbytes!
    Is there a way to tell mappoint to save to the clipboard in low resolution (or something like this)?
    If the only way is creating another function that lowers the resolution of my file I suppose it would take the same or more time than creating the gif through the html page...
    Any help will be appreciated!
    Thank you again,
    Giacomo
    Bisogna sognare, insistere, ripetere, finchŔ il sogno si trasformi in realtÓ

  4. #4
    giaarcix is offline Junior Member Yellow Belt
    Join Date
    May 2006
    Posts
    13

    other question

    Ok, I have understood another thing: the method I used (SavePicture Clipboard.GetData(), "c:\temp.gif") always saves the mappoint image as a BMP file and not a GIF.
    So I think the right question should be: is there a way to make VB save my image in other format than BMP?
    Thank you again,
    Giacomo
    Bisogna sognare, insistere, ripetere, finchŔ il sogno si trasformi in realtÓ

  5. #5
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433
    Hi,

    Yes you are right. Copy to clipboard is a bitmap image of the data. The formats you describe like bmp, gif, jpg, etc are file formats. They have eventually compressed methods with or without data loss.

    So indeed it is VB that has to have a function to save a bitmap to a gif or any other file format. But you loosing me My native language is object pascal, C#, Flemish and a little English, so I cannot help. But sure others will drop in here !

  6. #6
    allocater is offline Junior Member White Belt
    Join Date
    Dec 2007
    Posts
    1

    Re: Create gif file from mappoint

    i tried this code in VBA, but VBA does not know "Clipboard", so how do I do this in VBA?

  7. #7
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433

    Re: Create gif file from mappoint

    Hi,

    Then you have to call the windows API functions. This is possible in any language, but I have no idea how to do this in VBA. Hope someone else will drop in here.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to create a file per customer and how to search.
    By tlpike2 in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 10-21-2005, 03:11 PM
  2. How to create map file ( image_map.gif ) of given fix size.?
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 06-24-2004, 07:36 PM
  3. I am new to MapPoint and am trying to create a dat....
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 11-29-2001, 09:07 AM
  4. Does Mappoint allow you to create territories with....
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 10-31-2001, 02:08 PM
  5. I am using MapPoint 2002 to create a map of our sa....
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 10-10-2001, 03:06 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


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