Hi Sarah,
The converting routines are already in the ScaledMaps program:
If you look at the lines 1479-1493.
Code:
<font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">Sub </font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font face="Courier New"><font size="2">Long_X(long)</font></font>
</font></font><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"> Return </font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">Int</font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font face="Courier New"><font size="2">((long-MapLong10)/ScaleX+</font></font></font></font><font face="Courier New"><font size="2"><font color="#800080"><font face="Courier New"><font size="2"><font color="#800080"><font face="Courier New"><font size="2"><font color="#800080">.5</font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font face="Courier New"><font size="2">)</font></font>
</font></font><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">End Sub</font></font></font>
</font></font></font></font></font></font><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">Sub </font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font face="Courier New"><font size="2">Lat_Y(lat)</font></font>
</font></font><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"> Return </font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">Int</font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font face="Courier New"><font size="2">((lat-MapLat10)/ScaleY+</font></font></font></font><font face="Courier New"><font size="2"><font color="#800080"><font face="Courier New"><font size="2"><font color="#800080"><font face="Courier New"><font size="2"><font color="#800080">.5</font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font face="Courier New"><font size="2">)</font></font>
</font></font><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">End Sub</font></font></font>
</font></font></font></font></font></font><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">Sub </font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font face="Courier New"><font size="2">X_Long(x)</font></font>
</font></font><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"> Return</font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font face="Courier New"><font size="2"> MapLong10+(x-ScreenX+ImageX)*ScaleX</font></font>
</font></font><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">End Sub</font></font></font>
</font></font></font></font></font></font><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">Sub </font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font face="Courier New"><font size="2">Y_Lat(y)</font></font>
</font></font><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"> Return</font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font face="Courier New"><font size="2"> MapLat10+(y-ScreenY+ImageY)*ScaleY</font></font>
</font></font><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">End Sub</font></font></font></font></font></font></font></font></font>
For example the routine
Sub Long_X(long) converts the physical map
long value to the
x coordinate of the map's image in pixels.
long - MapLong0 = distance of the
long coordinate from the left border of the map in physical units
(long - MapLong10)/ScaleX = distance of the
x coordinate from the left border of the map's image in pixels
Int((long-MapLong10)/ScaleX+.5) rounds to an integer value
The routine
Sub X_Long(x) converts the screen
x coordinate to the physical
long coordinate on the map.
x-ScreenX = distance of
x from the screen left border, in pixels
x-ScreenX+ImageX = distance of
x from the map's image left border, in pixels
(x-ScreenX+ImageX)*ScaleX = distance of
long from the map's image left border, in physical units
MapLong10+(x-ScreenX+ImageX)*ScaleX =
long in physical units
Screen is the display surface on the form.
MapLong10 = value of the left border of the map image, in physical units
ImageX = value of the left border of the screen, in pixels (the map image is bigger than the screen)
ScreenX = distance between the form's and the screen's left borders, in pixels
You'll find more information in the
http://www.basic4ppc.com/forum/tutor...-tutorial.html in the
Vector graphics chapter in the
Show scaled image topic.
Best regards.