back | source
Geometries creation from Well-known text
  1. Create overlay from well-known text
    var wkt1 = longdo.Util.overlayFromWkt('POINT(100 13)');
    map.Overlays.add(wkt1[0]);
    • POINT(0 0): Well-known text (WKT)
    • wkt1: Array of geometries
    Example
  2. Option can be added (same as polygon creation)
    var wkt4 = longdo.Util.overlayFromWkt(
      'MULTIPOINT((100 12),(101 12))',
      { lineWidth: 10 }
    );
    map.Overlays.add(wkt4[0]);
      .add(wkt4[1]);
    Example
  3. A circle can be created from the point.
    var wkt7 = longdo.Util.overlayFromWkt(
      'MULTIPOINT (100 13, 100.5 13)',
      { radius: 0.5 },
      longdo.Circle
    );
    map.Overlays.add(wkt7[0]);
    • longdo.Circle: Class of geomerty
    Example
  4. Convert overlay to well-known text
    var wkt = longdo.Util.overlayToWkt(wkt1);
    Example

Custom line layout
  1. Assign draw line function in option
    var line1 = longdo.Polyline([{ lon: 99, lat: 13 }, { lon: 97, lat: 17 }], { linePattern: linePattern1 });
    
    function linePattern1(context, i, x1, y1, x2, y2) {
      context.moveTo(x1, y1);
      context.quadraticCurveTo(x2, y1, x2, y2);
    }
    • context: 2D context of Canvas API
    • i: sequence of polyline
    • x1, y1: Strating point
    • x2, y2: End point
    More information: Canvas API

    Example