function LoadGeoJSONPolygon
function LoadGeoJSONPolygon (AFilename: string; BorderColor: TColor = clBlue; Opacity: Integer = 255; BackgroundColor: TColor = clBlue; BackgroundOpacity: Integer = 100; AWidth: Integer = 2; Zoom: Boolean = True; HoverBorderColor: TColor = clBlue; HoverBackgroundColor: TColor = clBlue): string
Description
This function loads coordinates from a GEOJSON file and displays it on the map as a Polygon or Polygons. Optionally set the BorderColor, Opacity, BackgroundColor, BackgroundOpacity, Width, HoverBorderColor, HoverBackgroundColor of the Polygon(s). Optionally set Zoom to true to automatically zoom the map to the bounds of the Polygon(s).
Function parameters:
Parameter |
Type |
Description |
AFilename |
String |
GeoJSON file name. |
BorderColor |
The color that will be used to border the polygons. The default color is blue. Optional parameter. |
|
Opacity |
Integer |
The degree of transparency of the polygon border. Values from 0 to 255. Optional parameter. |
BackgroundColor |
The color that will be used to build the polygon. The default color is blue. Optional parameter. |
|
BackgroundOpacity |
Integer |
The degree of transparency of the polygons. Values from 1 to 100. Optional parameter. |
AWidth |
Integer |
The width of the border for polygons. The default width is two pixels. Optional parameter. |
Zoom |
Boolean |
Determine whether the polyline should be automatically shown on the map. Optional parameter. |
HoverBorderColor |
The color that the border of the polygon will have when the mouse cursor is over it. The default color is blue. Optional parameter. |
|
HoverBackgroundColor |
The color the polygon 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":"Polygon1"
},
"geometry":{
"type":"Polygon",
"coordinates": [[
[-105.431410315776, 20.878495854271],
[-105.445432904506, 20.8727217105441],
[-105.451183560633, 20.8762102822492]
]]
}
},
{
"type":"Feature",
"properties": {
"name":"Polygon2"
},
"geometry":{
"type":"Polygon",
"coordinates": [[
[-105.491410315776, 20.878495854271],
[-105.495432904506, 20.8727217105441],
[-105.491183560633, 20.8762102822492]
]]
}
}
]
}
Подробней о GeoJSON формате можно прочитать здесь https://geojson.org/
Example
Form1.Map1.LoadGeoJSONPolygon('D:\polygons.geojson');