Description


This function loads coordinates from a GEOJSON file and displays it on the map as a Polyline or Polylines. Optionally set the Color, Opacity, Width, HoverColor of the Polyline(s). Optionally set Zoom to true to automatically zoom the map to the bounds of the Polyline(s).



Function parameters:

 Parameter

 Type

 Description

 AFilename

 String

 GeoJSON file name.

 AColor

 TColor

 The color that will be used to draw the polyline. The default color is blue. Optional parameter.

 Opacity

 Integer

 The degree of transparency of the polyline. Values from 0 to 255. Optional parameter.

 AWidth

 Integer

 The width of the polyline. The default width is two pixels. Optional parameter.

 Zoom

 Boolean

 Determine whether the polyline should be automatically shown on the map. Optional parameter.

 HoverColor

 TColor

 The color the polyline will have when the mouse cursor is over it. The default color is blue. Optional parameter.




An example of a GeoJSON file:


{
    "type":"FeatureCollection","features":[
        {
            "type":"Feature",
            "properties": {
                "name": "Polyline1"
            },
           
            "geometry":{
                "type": "LineString",
                "coordinates": [[
                    [-105.431410315776, 20.878495854271],
                    [-105.445432904506, 20.8727217105441],
                    [-105.451183560633, 20.8762102822492]
                ]]
            }
        },
       
       
        {
            "type":"Feature",
            "properties": {
                "name":"Polyline2"
            },
           
            "geometry":{
                "type": "LineString",
                "coordinates": [[
                    [-105.491410315776, 20.878495854271],
                    [-105.495432904506, 20.8727217105441],
                    [-105.491183560633, 20.8762102822492]
                ]]
            }
        }       
       
       
    ]
}




Read more about the GeoJSON format here https://geojson.org/





Example


Form1.Map1.LoadGeoJSONPolyline('D:\polylines.geojson');