Composant Delphi / Google Maps / OpenStreetMap / Leaflet  / Mappilary / Native Maps 100% Delphi 0% WebBrowser 0% Javascript

Import / Export

you are here :TECMap

TECMap can save and reload all its data in a simple text file, it includes not only the component's settings and views but also map data overlays

Alternatively, you can import/export your data in GPX, KML and GeoJSON formats but only geographical data are exploited.

Sauvegarde/Restauration

function SaveToFile(const filename:string):boolean;

Saves the map to a text file.

Use the .gpx , .kml and .json to specify a format, otherwise it is the internal format of ECMap that will be used

function LoadFromFile(const filename:string):boolean;

Load the map with a text file

Use the .gpx , .kml and .json to specify a format, otherwise it is the internal format of ECMap that will be used

LoadFromFile can download files on internet

16

 

property toGPX : string;

Property read/write which gives access to the data of the card in GPX format.

This property is used by SaveToFile, LoadFromFile.

property toTxt : string;

Property read/write which gives access to the data of the card in a text format.

This property is used by SaveToFile, LoadFromFile.

property ToKml : string;

Property in read / write which returns the overlays (all except the Labels) in Kml format

EarthView allows import/export KML in a larger format

property ToGeoJSON : string;

Property in read / write which returns / import overlays (just the markers, the polylines, polygons, circles and rectangles) to GeoJSON format

The affection of a value to toTxt, ToKml, ToGpx, ToGeoJSON or the loading of a file with LoadFromFile causes events OnBeforeChangeToTxt and OnAfterChangeToTxt.

OnLoadOverlay is also raised after the addition of each overlay (marker, polyline, polygon,...) that may allow you to adjust properties while loading data.

You can stop the load by switching StopLoadOverlay to true


// Delphi map component ECMap
//
procedure TFormDemoECMap.mapLoadOverlay(sender: TObject; const Index: Integer; const OverlayType: TOverlayType);
begin

case OverlayType of

ovMarker : begin
// override data marker
map.markers[index].name := 'your data';
end;

ovLine : begin
// override data Polyline
map.Polylines[index].Color := clBlue;
map.Polylines[index].Update;
end;

...

end;

// stop if too many markers
map.StopLoadOverlay := map.Markers.Count>3000;
end;

Backup / Restore

function SaveToFile(const filename:string):boolean;
Saves the map as a text file
function LoadFromFile(const filename:string):boolean;
Load the card with a text file
function SaveToKMLFile(const filename:string):boolean;
Saves overlays to the kml format
property toTxt : string;

Property read / write which provides access to map data in text format.

This property is used by SaveToFile, LoadFromFile.

property ToKml : string;

Read-only property that returns overlays (all but Labels) in kml format

This property is used by SaveToKmlFile

EarthView allows import / export KML

property ToGeoJSON : string;

Property in read / write which provides access to overlays (just the markers, polylines, polygons, circles and rectangles) in GeoJSON format

The affection of a value to toTxt causes and events OnBeforeChangeToTxt and OnAfterChangeToTxt the first place just before the change in fair value and the second after.

Setup import / export

When you import / export in text format, by default all the data are, whether the card settings (such as API, position etc.) or overlays ( markers , circles, roads etc.).

Just as when importing the old overlays are replaced by new.

Property ToTxtType offers some control.

// Delphi map component ECMap

// valeur par défaut,
// importe/exporte tout (map+overlay)
// remplace l'ancien contenu par le nouveau
map.toTxtType := [ttaMap,ttaOverlays,ttaReplace];

// importe/exporte tout (map+overlay)
// ajoute les nouveaux overlays à ceux déjà existant
map.toTxtType := [ttaMap,ttaOverlays];

// importe/exporte uniquement les paramètres de la carte
map.toTxtType := [ttaMap];

// importe/exporte uniquement les overlays
map.toTxtType := [ttaOverlays];

text format

each part is divided into section, data are named and need not be in any particular order.

Overlays for each line corresponds to a data element (a marker, a circle etc.)

Example map

[map]
draggable=true
draggablecursor=CrossHair
draggingcursor=
enableuicontrol=true
maptypecontrol=false
navigationcontrol=true
scalecontrol=false
zoomcontrol=true
mobilesenabled=true
latitude=43.2318637451068
longitude=0.0860298080261312
maptypeid=ROADMAP
maptypecontrolstyle=DEFAULT
maptypecontrolposition=TOP_RIGHT
navigationstyle=DEFAULT
navigationposition=TOP_LEFT
scalestyle=DEFAULT
scaleposition=BOTTOM_LEFT
zoomstyle=DEFAULT
zoomposition=TOP_LEFT
title=démo tarbes composant google map
zoom=15
[markers]
adress=;cursor=;icon=http://google-maps-icons.googlecode.com/files/home.png;shadow=;title=home;animation=BOUNCE;name=;icon.width=32;icon.height=37;icon.top=0;icon.left=0;icon.anchor.x=16;icon.anchor.y=37;shadow.width=59;shadow.height=32;shadow.top=0;shadow.left=0;shadow.anchor.x=16;shadow.anchor.y=32;alt=314.2731018;lat=43.2348454;lng=0.0756332;infowindow=-1;zindex=0;tag=0;clickable=true;draggable=true;dragging=false;flat=true;visible=true
adress=;cursor=;icon=;shadow=;title=classic;animation=;name=;icon.width=32;icon.height=32;icon.top=0;icon.left=0;icon.anchor.x=16;icon.anchor.y=32;shadow.width=59;shadow.height=32;shadow.top=0;shadow.left=0;shadow.anchor.x=16;shadow.anchor.y=32;alt=-9999;lat=45.7130572617061;lng=0.776228114733059;infowindow=-1;zindex=0;tag=0;clickable=true;draggable=true;dragging=false;flat=false;visible=true
adress=;cursor=;icon=http://maps.google.com/mapfiles/kml/pal4/icon40.png;shadow=;title=nuage;animation=;name=;icon.width=32;icon.height=32;icon.top=0;icon.left=0;icon.anchor.x=16;icon.anchor.y=32;shadow.width=59;shadow.height=32;shadow.top=0;shadow.left=0;shadow.anchor.x=16;shadow.anchor.y=32;alt=335.1564026;lat=43.2336125285346;lng=0.0755495857201656;infowindow=0;zindex=0;tag=0;clickable=true;draggable=true;dragging=false;flat=true;visible=true
adress=;cursor=;icon=http://google-maps-icons.googlecode.com/files/cycling.png;shadow=;title=Velo;animation=;name=;icon.width=32;icon.height=37;icon.top=0;icon.left=0;icon.anchor.x=16;icon.anchor.y=37;shadow.width=59;shadow.height=32;shadow.top=0;shadow.left=0;shadow.anchor.x=16;shadow.anchor.y=32;alt=316.4778442;lat=42.8695665637582;lng=-0.112703923657986;infowindow=-1;zindex=0;tag=0;clickable=true;draggable=true;dragging=false;flat=true;visible=true
[infowindows]
content=<h1>Nuage</h1><br>Image locale;anchor=2;maxwidth=0;zindex=0;lat=43.2336125285346;lng=0.0755495857201656;open=false
[routes]
startlat=43.23443;startlng=0.0737;endlat=43.24342;endlng=0.09581;wplat0=43.241668;wplng0=0.072025;travelmode=DRIVING;avoidhighway=false;avoidtolls=false;draggable=true;color=12615680;opacity=50;weight=5;zindex=1;name=Tarbes / Aureilhan;marker.icon=http://maps.google.com/mapfiles/ms/micons/blue-pushpin.png;marker.visible=true;marker.clickable=true;marker.flat=false
startlat=43.23313;startlng=0.07419;endlat=43.22849;endlng=0.10676;travelmode=DRIVING;avoidhighway=false;avoidtolls=false;draggable=true;color=33023;opacity=50;weight=5;zindex=1;name=Tarbes / Séméac;marker.icon=http://www.visual-case.it/vc/pics/casetta_base.png;marker.visible=true;marker.clickable=true;marker.flat=false
startlat=43.23481;startlng=0.07882;endlat=48.85631;endlng=2.35001;travelmode=DRIVING;avoidhighway=true;avoidtolls=false;draggable=true;color=32768;opacity=50;weight=5;zindex=1;name=Tarbes / Paris;marker.icon=http://maps.google.com/mapfiles/ms/micons/purple-pushpin.png;marker.visible=true;marker.clickable=true;marker.flat=false
startlat=43.00821;startlng=-0.09972;endlat=42.85121;endlng=-0.13994;travelmode=DRIVING;avoidhighway=false;avoidtolls=false;draggable=true;color=4868863;opacity=50;weight=5;zindex=1;name=Pont d'espagne;marker.icon=;marker.visible=true;marker.clickable=true;marker.flat=false
[mobiles]
0
distance=148;marker=2;route=1;speed=60;segment=2;mobile=true;direction=endstart
distance=338133;marker=1;route=2;speed=130;segment=2272;mobile=true;direction=startend
distance=21139;marker=3;route=3;speed=30;segment=329;mobile=true;direction=startend
[streetview]
latitude=-1
longitude=-1
visible=false
heading=140
pitch=10
zoom=1
navstyle=DEFAULT
navposition=TOP_LEFT
adrposition=TOP_LEFT
navcontrol=true
adrcontrol=true
closebtn=true
link=true
[polylines]
color=255;opacity=50;weight=5;zindex=1;latlng=43.2287477339158,0.0730968322387859,43.2326562567397,0.0736118163696453,43.2319683748977,0.0758863296142742,43.2296858022526,0.0752855147949383,43.2293731144111,0.0766588058105633;visible=true;clickable=true;geodesic=false;
[polygones]
color=16744448;opacity=80;weight=5;zindex=1;latlng=43.2392845896161,0.074169715844743,43.2389094105985,0.0777316894165203,43.236752086419,0.0775600280395672,43.2368146186294,0.0745130385986492;visible=true;clickable=true;geodesic=false;fillcolor=12615680;fillopacity=50
[circles]
color=16384;opacity=80;weight=3;zindex=1;latlng=43.2348454,0.0756332;visible=true;clickable=true;geodesic=true;fillcolor=32768;fillopacity=50;radius=127
[rectangles]
[labels]


Import / Export overlays

Overlays have also toTxt property allowing the importation and exportation, either in their list ( Markers , Routes etc.) than the item itself.

In terms of import lists is necessarily an addition, it is not considered property toTxtType which is supported at the global level.

FPanoramioLayer := TPanoramioLayer.create;
...
// connect TECMap component for show Panoramio layer
FPanoramioLayer.Map := map;
// deconnect layer
FPanoramioLayer.Map := nil

When using overlays toTxt you should not give section, all properties are not necessary.

5
go to page
© 2016 ESCOT-SEP Christophe - Made width Help&Web - RSS - Google+