Scaled Maps

Discussion in 'Share Your Creations' started by klaus, Jan 9, 2009.

  1. klaus

    klaus Expert Licensed User

    Here is an application for displaying scaled maps.

    The project began already in this thread , but ceasar and myself find that it's right place is here.

    What can be done:
    - Different maps can be loaded.
    - The maps can be scaled, and the scaling saved (two points only yet).
    - Drawings can be made onto the maps on 3 different layers:
    - polylines with different colors, line widths
    - circles with radius in meters, different colors, line widths, filled or empty
    - texts with different colors, font sizes, font styles, with or without background color
    - bitmaps, with or without background color, 4 bitmaps are predefined, these can be deleted and others loaded.
    - Select any element of the drawing and modify, or delete it. To change the position of an element, click on it, move it and release, or change the coordinates.
    - New points can be added to polylines.
    - Save and load drawings. The saved data is just the geometry of the drawing elements, with a reference to the map. To load drawings, the program shows only those belonging to the map.
    - Calculate the length of a polyline
    - 2 maps of Cape Town are included, one with a km scaling and the other one with long, lat in degrees, sources Google Maps and Google Earth.

    What can not be done yet:
    - Scaling with 3 points
    - Undo and redo

    What is still missing:
    - no GPS support

    The help file is here.
    It contains the help file itself and the map I used to create this help file.

    I would be pleased to have some feedback of what is missing, improvement suggestions and bug reports.

    Best regards.

    EDIT: 2009.11.21
    Version 2.0 bug renoval and some minor changes.

    EDIT: 2011.02.27
    Version 3.0 with a beginning of GPS support not really tested.
    Leave it as it is.

    Attached Files:

    Last edited: Feb 27, 2011
  2. ceaser

    ceaser Active Member Licensed User

    Hi Klaus

    Thanks for your effort and input. :sign0188: To be honest with you, I did not get a chance to play with it yet. I am trying very hard to get the Surveying program that I had running on the Workabout (from Psion) to run on a Windows Mobile device. I am nearly finished, but there are still some hicups that I need to sort out. Every surveyor that is using the old program is breathing down my neck to test out the new program.

    At the moment I am sitting here with 7 different surveying instruments that I need to interface and the approach is a bit different than in "OPL" or NSBasic.
    (I wasted my time with NSBasic!:sign0148:)

    This should take about another week, then I will work through your Mapping program and give you some feedback.

    Klaus, once again I say thank you very much for your help.:sign0188:

  3. klaus

    klaus Expert Licensed User

    Hi Michael,

    Don't worry, I saw with your other posts that you were quite busy with other problems. I did interface measurement instruments and a computer with serial port years ago in VB, but don't remember all details.

    There is now a help file in the first post.

    Best regards.
  4. Ariel_Z

    Ariel_Z Active Member Licensed User

    It's an amazing program, but there's a bug in it: If you zoom in to the maximun, scroll to the right-bottom corner, and then zoom out, there is a strech of the image. Then, when zooming in, an error ocurred in line 578 in module Map.bas.
  5. klaus

    klaus Expert Licensed User

    Hi Ariel,
    Thank you for the bug report.

    A new version is updated in the first post with some minor changes.
    The help has also been updated.

    Best regards.
  6. wm.chatman

    wm.chatman Well-Known Member Licensed User

    :) Hi Klaus

    it would be very cool to get the Scaling3points and GPS support in Version Scaled Map 2.0 to work. that would really be great, and a killer source, to learn from! :sign0060:

    Best regards
  7. klaus

    klaus Expert Licensed User

    Hi William,

    I don't plan it in a short time.
    If there is any interest from other users I could consider it.
    Probably not the GPS support because I am writing another GPS program.

    But feel free to take it and add your own code.

    Best regards.
  8. wm.chatman

    wm.chatman Well-Known Member Licensed User

    I understand.

    Best regards
  9. SarahWard

    SarahWard Banned

    Hi Klaus

    I have been looking at your program scaled map with the idea of adding the gps part to it.

    Did you ever work out the code for converting a lat/long coord set to your program's map-scale coordinate?

    If I could convert a lat / long (or utm) coordinate set to your scaled map coordinate system I could add the gps functionality.

  10. wm.chatman

    wm.chatman Well-Known Member Licensed User

    :) Hi Sarah Ward

    Thats sounds fantastic!

    PS. i am able to set a pizel on the Map, and thats all yet. Ha, ha.

    I am a bit slow with Variables and constants, and a few other.

    Best regards

    Last edited: Dec 23, 2009
  11. klaus

    klaus Expert Licensed User

    Hi SarahWard,

    In the 'ScaledMaps' program there is no dedicated unit system.
    It's up to the user to select the right coordintate units and to enter the correct values for the upper left and lower right corner or reference lines.

    When you scale a map you can select the unit type.
    Selecting 'degrees' can mean UMT units.
    Setting the UMT values for the upper left and lower right corner your map is scaled in UMT units.
    If you look at the 'ShowScaledMap' program in the Graphics Tutorial it's an example of a same map image with 2 different scales. The scales are defined by the coordinate values of the upper left and lower right corner.

    The 'ScaledMaps' program assumes that your map image is oriented north-south. It's intended for relative small maps, there is no calculation of the longitude difference in the upper and lower border.

    Best regards.
  12. SarahWard

    SarahWard Banned

    Hi William

    You say you are able to set a pixel. Do you mean literally setting an x/y coord pixel, or have you been able to set a gps coord on the scaled map as a pixel?
  13. wm.chatman

    wm.chatman Well-Known Member Licensed User

    :) Hi Sarah Ward

    sad reply...

    meaning literally I can set an x/y pixel on Form or Image. Still working on setting a gps coord on the map as a pixel itself. Setting gps coord is still out of bounce.

    Best regards and Merry Xmas / Happy New Year.

    Last edited: Dec 24, 2009
  14. derez

    derez Expert Licensed User

    You want it like this image ? The red dashed line is the result of a GPS recording, driving on a new road which is not marked yet on the map.
    Last edited: Dec 25, 2009
  15. wm.chatman

    wm.chatman Well-Known Member Licensed User

    its nice that you can code such functions...
  16. SarahWard

    SarahWard Banned

    Absolutely David

    I need the code that takes the lat/long coord and makes it a map plottable x/y coord on the scaledmap display. If you have achieved that then I would be most grateful for the alghorthymn that does the coverting part. I would like to add a front end to Klaus's excellent mapscale software.

  17. derez

    derez Expert Licensed User

    Here it is. Explanations in the code.

    tempx = point(0).geo_long ' this holds the longitude of present position
    tempy = point(0).geo_lat   ' and this - the latitiude
    left = (tempx - x1 )* mapwidth /(x2-x1) - center_x/zoom 
    top  = (tempy - y1 )* mapheight/(y2-y1) - center_y/zoom 

    ' (x1,y1) and (x2,y2) are the coordinates of the corners of the map used.
    'mapwidth is the map width in pixels.
    ' center_x and center_y are  175 - the middle of the clipboard image.
    ' zoom is 1 for original size, 1.25 means 125% zoom in, 0.8 means 125% zoom-out etc.

    IWZ = IW/zoom  
    ' IW = 350, its a clipboard image size
    IHZ = IH/zoom    ' IH = 350

    bmx.New1(AppPath & 
    "\images\350.jpg"' clears previous map from bmx, the picture is a blank one. bmx is a bitmapEx object.
    drawer.New2(bmx.Value)          ' re-declare the drawer to the new image, drawer is a drawerEx object.

    If left < 0 Then
       mw = IWZ + left 
       destx = - left*zoom
       startx = 
       mw = 
    Min(mapwidth - left, iwz)
       destx = 
       startx = left
    End If
    If top < 0 Then
       mh = IHZ + top
       desty = -top*zoom
       starty = 
       mh = 
    Min(mapheight - top,ihz)
       desty = 
       starty = top
    End If

    If mw >= 1 AND mh >= 1 Then 
    ' tmap is a bitmapEx object
       tmap1.Value = jpeg.LoadArea(mapname,startx,starty,mw,mh)
    ' mapdst and mapsrc are rectangleEx objects.

    55,40,240,268)  ' size of a form, from the center of bmx
                dst.new1(0,0,240,268' a form size
                drx.DrawImage(bmx.Value,src.Value,dst.Value,False' drx is a drawerEx object which draws on the form.
    End If
    1. the code is taken from few subs, some lines need to be done only once,others for every new position.
    2. The use of a clipboard with size of 350x350 is to enable rotation of the map before copying to the form, without loosing the corners. Rotation is not in the code above.
    3. The map drawn on the form is a moving map, the present position is the center of the form (draw a circle or something there on the forelayer).

    I hope I forgot no crucial elements. Try to play with it, and when you're ready I'll show you the path drawing part as well.
    Last edited: Dec 26, 2009
  18. wm.chatman

    wm.chatman Well-Known Member Licensed User

    :) thanks for sharing!

    derez, your great.

    BTW: Klaus has a Draw Circle function already coded, can this be used?

    Best regards.

  19. derez

    derez Expert Licensed User

    You don't need that one, just (from the help):

  20. wm.chatman

    wm.chatman Well-Known Member Licensed User

    as always, I just try the wrong things... :(
    place code into frmMain, right!?

    BTW: the code you posted #17, where do I need to place? :confused: frmMainLoad?

    Best regards.

    Limited Knowledge
    Last edited: Dec 26, 2009
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice