-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Import KLM file for add polygones by tracks #21
Comments
Hello, |
I communicating with [Fr0sT-Brutal with my KML reader |
Hi,for me , it's not possible to load a KML file in the software. I've a error windows :
I give you a KML file that I useThanksFrançois
Je pense ENVIRONNEMENT: ai-je vraiment besoin d'imprimer ce message ?
Please consider the environment before printing this email.
Le mardi 24 octobre 2023 à 10:05:34 UTC+2, limelect ***@***.***> a écrit :
I communicating with [Fr0sT-Brutal with my KML reader
and allowing him to add it to his source
I am using his source to change from Google to open street
this is the application I am changing
https://limelect.com/downloads/kml-reader/
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
@ClubACNews what exact error do you have? I made a VERY quick, dirty and dumb KML loader and it works (loads from fixed-named 'route.kml' file near the EXE) procedure TMainForm.Button1Click(Sender: TObject);
var
sl: TStringList;
i: Integer;
s: string;
fs: TFormatSettings;
Track: TTrack;
coords: TStringDynArray;
begin
sl := TStringList.Create;
sl.LoadFromFile('route.kml', TEncoding.UTF8);
// look for first '<coordinates>' line, then consider next line as space-separated series of geo points
for i := 0 to sl.Count - 1 do
if Trim(LowerCase(sl[i])) = '<coordinates>' then
begin
s := sl[i + 1];
Break;
end;
if s = '' then Exit;
sl.Delimiter := ' ';
sl.DelimitedText := s;
fs := TFormatSettings.Create(LOCALE_NEUTRAL);
fs.DecimalSeparator := '.';
Track := TTrack.Create;
SetLength(Track.Points, sl.Count);
for i := 0 to sl.Count - 1 do
begin
coords := SplitString(sl[i], ',');
Track.Points[i] := TGeoPoint.Create(StrToFloat(coords[0], fs), StrToFloat(coords[1], fs));
end;
Track.LineDrawProps := DefLineDrawProps;
Track.LineDrawProps.Color := RandomColor;
mMap.Tracks.Add(Track);
FreeAndNil(sl);
end; |
Hi, |
Built with trunk FPC/Laz, 1st region is OK (but had to modify the KML as the loading code is DUMB and expects coords on a separate line. Also FPC has no TFormatSettings.Create so modification is needed: {$IFDEF DCC} |
excellent ! |
It is possible of course - just use proper XML reader to find all the coord nodes. Lazarus has it built-in. If you need filled regions, tracks likely won't fit - you'll have to draw the regions by yourself. See the mMapDrawLayer method in Demo for example and read TCanvas' reference (namely Polygon). ATM I have no plans of adding regions but who knows... maybe if you succeed in this, you'll contribute the code for others ;) |
Hello everyone I rarely enter GitHub, but looking for an application to monitor maps, I found this one that seemed like a fantastic job, so I decided to collaborate I am Spanish and I am translating into English with Google, so forgive my English I see that among the pending tasks is being able to view Track and Waypoint in different formats, although this thread talks about KML I have prepared a Unit to load Track and Waypoint files in Kml, Gpx, Csv, Txt formats called OSM.TracksAndMarks For Waypoints or Marks, I have added two new icon formats, gshRectangle and gshEllipse, so I have modified the OSM.MapControl unit to add them. In the header of the unit is the description of the changes, which were made on the latest version v.0.11.4 To load the Track and Waipoint, just add two buttons to the MainForm, one for the Marks and one for the Tracks, along with a TComboBox to define the color of the Track. The necessary code is put in the header of OSM.TracksAndMarks As this is the first time I collaborate on Github and contribute code, I don't really know how to proceed, so you can download the two units OSM.TracksAndMarks and OSM.MapControl from my DropBox in this link https://www.dropbox.com/scl/fo/1plv13h8alqkl0nfrzye1/h?rlkey=6uml3vf7hw4o9kpxbpu6xqaaq&dl=0 The code explains the necessary format for .Csv and .Txt files To load the marks, I have added some standard configuration procedures for each drawing form, which must be executed before loading the files The only problem I have encountered is that the Track lines always overlap the Waypoint / Marks, and I can't find anywhere to do a BringToFront to be able to leave the Tracks below Also missing is the ability to load Google orthophotos, although I see that you are working on it Regards |
I already used this component Check kml files as there are strange one |
Hello, thanks for contribution! I'll try to examine it in near time |
Good morning,
I use KLM files to represent specific companies. they are drawn under geoportal (https://www.geoportail.gouv.fr/) in a 'Web mercator' coordinate format.
Would it be possible to add an import of these coordinates to display them as a polygon with tracks?
I have a component that creates filled polygons but I don't know how to pass it to you.
THANKS
The text was updated successfully, but these errors were encountered: