Coder Social home page Coder Social logo

Comments (11)

Fr0sT-Brutal avatar Fr0sT-Brutal commented on July 30, 2024

Hello,
currently reading KML files is beyond my TODO but if you find a reader that provides you with coordinates you should easily add tracks and polygons (see Demo actions under btnAddRouteClick for tracks and mMapDrawLayer for polygon)

from delphi_osmmap.

limelect avatar limelect commented on July 30, 2024

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/
I can send you a demo although [Fr0sT-Brutal has my source

from delphi_osmmap.

ClubACNews avatar ClubACNews commented on July 30, 2024

from delphi_osmmap.

Fr0sT-Brutal avatar Fr0sT-Brutal commented on July 30, 2024

@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;

from delphi_osmmap.

ClubACNews avatar ClubACNews commented on July 30, 2024

Hi,
I give you a kml file and it's representation on a map.
Now, i use an release 2.26 of Lazarus and I don't know how to use this component if I need the latest version in development. I don't want to break what it works
Croquis E1-E5.zip

from delphi_osmmap.

Fr0sT-Brutal avatar Fr0sT-Brutal commented on July 30, 2024

image

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}
fs := TFormatSettings.Create(LOCALE_NEUTRAL);
{$ELSE}
fs := DefaultFormatSettings;
{$ENDIF}

from delphi_osmmap.

ClubACNews avatar ClubACNews commented on July 30, 2024

excellent !
In the example, there are 5 zones denoted E1 to E5. Is it possible to load them all at once?
I'm going to create a virtual machine and install a Lazarus trunk in it.
I have an example source for creating filled polygons. How can I give them to you without going through an attachment from this github? This is a licensed component.
I create my kml from a French government site "geoportal" allowing you to select different base maps to easily locate and delimit the area that the archaeologists are going to excavate. The KML format is imposed during registration by the site.

from delphi_osmmap.

Fr0sT-Brutal avatar Fr0sT-Brutal commented on July 30, 2024

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 ;)

from delphi_osmmap.

jmgias avatar jmgias commented on July 30, 2024

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

Track y Wp

Also missing is the ability to load Google orthophotos, although I see that you are working on it

Regards

from delphi_osmmap.

limelect avatar limelect commented on July 30, 2024

I already used this component
https://limelect.com/downloads/kml-reader/https://limelect.com/downloads/kml-reader/

Check kml files as there are strange one
put a test program here as I have many odd kml or gpx
my program read them all
or send it to me to check

from delphi_osmmap.

Fr0sT-Brutal avatar Fr0sT-Brutal commented on July 30, 2024

Hello everyone

Hello, thanks for contribution! I'll try to examine it in near time

from delphi_osmmap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.