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.
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?
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.
William
Last edited by wm.chatman : 12-24-2009 at 10:13 PM.
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.
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.
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 < 0Then mw = IWZ + left destx = - left*zoom startx = 0 Else mw = Min(mapwidth - left, iwz) destx = 0 startx = left EndIf If top < 0Then mh = IHZ + top desty = -top*zoom starty = 0 Else mh = Min(mapheight - top,ihz) desty = 0 starty = top EndIf
If mw >= 1AND mh >= 1Then tmap1.New2(mw,mh) ' tmap is a bitmapEx object tmap1.Value = jpeg.LoadArea(mapname,startx,starty,mw,mh) mapdst.New1(destx,desty,tmap1.Width*zoom,tmap1.Height*zoom) ' mapdst and mapsrc are rectangleEx objects. mapsrc.New1(0,0,tmap1.Width,tmap1.Height) drawer.DrawImage(tmap1.Value,mapsrc.Value,mapdst.Value,False)
src.New1(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. EndIf
notes:
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.
__________________
David Erez
Ramat Hasharon, Israel