Topic: LoadGeoJSONPolygon

Hello MVD!

In the current version of MVD, we do not have a method or properties to load GeoJSON FIle. We have only LoadGPSRoute.  please help on how to upload a polygon file...

Thanks!

Re: LoadGeoJSONPolygon

Hello.


Please download latest beta version
https://www.dropbox.com/s/to42wv53pdc0g … a.zip?dl=0


function LoadGeoJSONPolyline(AFilename: string; AColor: TColor = clBlue; Opacity: integer = 255; AWidth: integer = 2; Zoom: boolean = true; HoverColor: TColor = clBlue): string
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


Examples:

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

Polyline 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]
                ]]
            }
        }        
        
        
    ]
}



Form1.Map1.LoadGeoJSONPolygon('D:\polygons.geojson');  

Polygon 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]
                ]]
            }
        }        
        
        
    ]
}
Dmitry.

3 (edited by manixs2013 2019-06-20 01:31:43)

Re: LoadGeoJSONPolygon

WOW.... THANKS DRIVESOFT.. PERFECT

************************

Is there also a way to load KML file?  please... Thanks4x

Re: LoadGeoJSONPolygon

Download latest beta version again
https://www.dropbox.com/s/to42wv53pdc0g … a.zip?dl=0


Example

Form1.Map1.AddMapKMLLayer('https://developers.google.com/kml/documentation/KML_Samples.kml', true); 
Form1.Map1.DeleteAllMapKMLLayer;

But using local files isn't supported. This is actually a limitation from the Google Maps API.


KML uses a tag-based structure with nested elements and attributes and is based on the XML standard.
More info: https://developers.google.com/kml/documentation/kml_tut


So you can use OLE MSXML2.DOMDocument to open XML files and parse them.

Dmitry.

Re: LoadGeoJSONPolygon

OK DRIVESOFT!

You are so kind!

Thanks4x!