ImageEn, unit iexVirtualBitmaps

TIESlippyMap.LongitudeToBmpX

TIESlippyMap.LongitudeToBmpX


Declaration

function LongitudeToBmpX(lon: double): integer;


Description

Converts from longitude to bitmap horizontal position.
This conversion depends on the current Latitude, Longitude, PointPosition and Zoom.

Parameter Description
lon Longitude in decimal degrees


Example

// Save an image with pins drawn for GPS coordinates
const
  Pin_Width  = 40;
  Pin_Height = 40;
var
  i: integer;
  idx: integer;
  lat, lon: double;
  x, y: integer;
  fn: string;
begin
  // Prompt for a filename
  fn := ImageEnView1.IO.ExecuteSaveDialog();
  if fn = '' then
    exit;

  // Hide changes from view
  ImageEnView1.LockUpdate();
  try

    // Add pins as shape layers
    for i := 0 to ImageEnMView1.MultiSelectedImagesCount - 1 do
    begin
      idx := ImageEnMView1.MultiSelectedImages[i];
      lat := ImageEnMView1.MIO.Params[idx].EXIF_GPSLatitude;
      lon := ImageEnMView1.MIO.Params[idx].EXIF_GPSLongitude;
      x := map.LongitudeToBmpX(lon);
      y := map.LatitudeToBmpY(lat);

      ImageEnView1.LayersAdd( iesPinLeft, x, y - Pin_Height, Pin_Width, Pin_Height );
    end;

    // Save current image + layers to file
    ImageEnView1.LayersSaveMergedTo( fn );

    // Clean up
    ImageEnView1.LayersClear(False);

  finally
    // Reenable ImageEnView1
    ImageEnView1.UnlockUpdate();
  end;
end;


See Also

BmpYToLatitude
BmpXToLongitude
LatitudeToBmpY