click here for a list of all existing Templot documentation
TEMPLOT CLUB - this old web site is now  READ-ONLY

to post new messages, please go to

NEW WEB SITE - CLICK HERE       more info - click here


     you are not logged in  - Login | Join

    Recent Topics

Front Page  Search  My Account  Members   



                 Making sense of program code in Lazarus
  Page:  First Page Previous Page  1  2       
 Start new topic   Reply blank   Printer friendly 
  Rate this topic  
AuthorMessage
 Clicked a link? Wrong message? Wait until the page has finished loading, click in the address bar and then press the Enter key. This is a timing bug in some browsers.
41st message | this message only posted: 11 Mar 2020 02:46
 PM  Reply with quote  Reply blank 
from:
Martin Wynne
West Of The Severn, United Kingdom



view images in gallery
view images as slides

Please do not send requests for help direct to me via email or PM.

Post your questions on the forum where everyone can see them and add helpful replies.
p.s. Derek,

If you were thinking of swapping to Delphi for a full business project, you can purchase some very fancy buttons and other controls from suppliers such as DevExpress and others:

 https://www.devexpress.com/products/vcl/

But I doubt they would work with Lazarus.

cheers,

Martin.





__________
message ref: 29203

 
 Clicked a link? Wrong message? Wait until the page has finished loading, click in the address bar and then press the Enter key. This is a timing bug in some browsers.
42nd message | this message only posted: 14 Mar 2020 15:24
 PM  Reply with quote  Reply blank 
from:
DerekStuart
United Kingdom

 

view images in gallery
view images as slides
Thanks Martin. As ever, I'm appreciative of your help.

I notice using TSpeedButton the background colour still remains grey, as per the normal button. This isn't an issue as it can be overlaid with 100% bitmap anyway.

I'm getting there now. Slowly!

Derek
__________
message ref: 29206

 
 Clicked a link? Wrong message? Wait until the page has finished loading, click in the address bar and then press the Enter key. This is a timing bug in some browsers.
43rd message | this message only posted: 14 Mar 2020 17:21
 PM  Reply with quote  Reply blank 
from:
Martin Wynne
West Of The Severn, United Kingdom



view images in gallery
view images as slides

Please do not send requests for help direct to me via email or PM.

Post your questions on the forum where everyone can see them and add helpful replies.
DerekStuart wrote: I notice using TSpeedButton the background colour still remains grey, as per the normal button. This isn't an issue as it can be overlaid with 100% bitmap anyway.Hi Derek,

I see in Lazarus (but not in Delphi5) that TSpeedButton does have a Color property -- but to make it work you must also set Transparent to False.

The default background colour is actually clBtnFace, which is the current colour set in Windows, so that it matches other Windows applications and ordinary TButtons. If the user were to change their Windows desktop theme, the SpeedButtons would change accordingly.

All TGraphicControls have an accessible Canvas property. You can therefore draw whatever you want on the button in any colour. For example on a large SpeedButton you could draw the entire Templot trackplan. :)

To do such things you need to add a handler in the SpeedButton's Paint event (in the events column on the Object Inspector):

procedure Tmy_form.my_speedbuttonPaint(Sender:TObject);

begin
  with my_speedbutton.Canvas do begin

    Brush.Color:=clYellow;
    Brush.Style:=bsSolid;
    FillRect(Rect(0,0,my_speedbutton.Width,my_speedbutton.Height));

    Font.Name:='Arial';
    Font.Size:=12;
    Font.Color:=clRed;
    TextOut(0,0,'click me');

  end;//with

end;

which would make the button colour yellow all over with the text click me on it in red, in Arial size 12, at the top-left of the button.

Note that once you do this sort of thing, you make yourself responsible for all the other built-in functions, such as drawing the borders, latched-down appearance, etc.

cheers,

Martin.

__________
message ref: 29207

 
 Clicked a link? Wrong message? Wait until the page has finished loading, click in the address bar and then press the Enter key. This is a timing bug in some browsers.
44th message | this message only posted: 14 Mar 2020 17:30
 PM  Reply with quote  Reply blank 
from:
Martin Wynne
West Of The Severn, United Kingdom



view images in gallery
view images as slides

Please do not send requests for help direct to me via email or PM.

Post your questions on the forum where everyone can see them and add helpful replies.
p.s. Derek,

edit above, added note about Transparent.

Martin.

__________
message ref: 29208

 
 Clicked a link? Wrong message? Wait until the page has finished loading, click in the address bar and then press the Enter key. This is a timing bug in some browsers.
45th message | this message only posted: 25 Mar 2020 13:50
 PM  Reply with quote  Reply blank 
from:
DerekStuart
United Kingdom

 

view images in gallery
view images as slides
As ever, thank you.

I have now got to the point where I'm trying out chapter 3 "Your first application."

Databases is an area of particular interest to me. I've read up a bit on connecting MySQL, SQLite and Firebird. However, the example in Delphi shows its own pre-installed test database. It also mentions a control named "TTable" which is in the data access tab; but there's nothing named similar- do you know which it is, please? The rest all seems quite straight forward on a dry run- he says...

Anyway, apart from that I hope you- and all forum users for that matter- are keeping safe in this surreal period.

Derek
__________
message ref: 29232

 
 Clicked a link? Wrong message? Wait until the page has finished loading, click in the address bar and then press the Enter key. This is a timing bug in some browsers.
46th message | this message only posted: 25 Mar 2020 14:25
 PM  Reply with quote  Reply blank 
from:
DerekStuart
United Kingdom

 

view images in gallery
view images as slides
Hello Martin

I've just stumbled across this site. It is well worth noting for anyone else reading this who wants to learn. Simple to follow guides and working downloadable files to see, dissect and reverse-engineer etc.

http://www.festra.com/fp/index.htm

Thanks
Derek
__________
message ref: 29233

 
 Clicked a link? Wrong message? Wait until the page has finished loading, click in the address bar and then press the Enter key. This is a timing bug in some browsers.
47th message | this message only posted: 25 Mar 2020 20:59
 PM  Reply with quote  Reply blank 
from:
Martin Wynne
West Of The Severn, United Kingdom



view images in gallery
view images as slides

Please do not send requests for help direct to me via email or PM.

Post your questions on the forum where everyone can see them and add helpful replies.
Hi Derek,

Thanks for the link, some interesting stuff there.

I regret to say that my knowledge of database programming is nil. Early versions of Delphi included the BDE (Borland Database Engine), but I never had any need for it so never learned anything about it.

I found this page which contains a lot of sample Lazarus code and may be helpful:

 https://wiki.freepascal.org/How_to_write_in-memory_database_applications_in_Lazarus/FPC

Also, this database package for Lazarus/FPC may be worth a look:

 https://wiki.freepascal.org/ZMSQL

It's open-source, so the code could be a useful guide for your own database program.

cheers,

Martin.

__________
message ref: 29234

 
 Clicked a link? Wrong message? Wait until the page has finished loading, click in the address bar and then press the Enter key. This is a timing bug in some browsers.
48th message | this message only posted: 11 Apr 2020 13:50
 PM  Reply with quote  Reply blank 
from:
DerekStuart
United Kingdom

 

view images in gallery
view images as slides
Hello Martin

I hope you- and everyone else here for that matter- is well.

I thought you might appreciate an update in view of all the help you've given.

I'm not about to throw in my day job (if it still exists post-corona) but I think I've become an 'advanced beginner'(!) in respect of using Lazarus for database management. I can see the fascination you mentioned before ("I wonder, if I do X can I make it do Y and will Z then work"). Many nights going to bed at dawn due to 'one last experiment.'

Anyway, that's it- I just wanted you to know your help and advice wasn't wasted. I'm not about to write Templot 4, but if anyone ever needs a database... (actually, there's an element of the disciplines used in Templot that I will need to explore in due course, so you never know.)

Again, thanks for introducing me to this fantastic hobby- which post corona might end up as my job...

Keep safe.

Derek
__________
message ref: 29308

 
 Clicked a link? Wrong message? Wait until the page has finished loading, click in the address bar and then press the Enter key. This is a timing bug in some browsers.
49th message | this message only posted: 11 Apr 2020 22:28
 PM  Reply with quote  Reply blank 
from:
Martin Wynne
West Of The Severn, United Kingdom



view images in gallery
view images as slides

Please do not send requests for help direct to me via email or PM.

Post your questions on the forum where everyone can see them and add helpful replies.
Hello Derek,

Many thanks for those kind words. You may not realise how much they mean to me. I sometimes spend hours writing stuff and I often wonder if I'm wasting my time, that no-one will ever bother to read it. Especially when posting on RMweb.

I'm really pleased that you are enjoying coding. I know all about going to bed at dawn, especially when "just one more thing to try" doesn't work, and I just know that I won't be able to sleep until I have solved it. :)

Nowadays I force myself to switch off by doing something else for half an hour -- usually the dreaded OSM which can be just as much an addiction if I'm not careful. Just yesterday on my daily Boris walk I was making a careful note of the positions of the power poles in a couple of local fields because I wasn't sure I had got them marked correctly. I noticed no-one else fretting about which side of the hedge they were on. :)

stay safe,

Martin.

__________
message ref: 29314

 
 Clicked a link? Wrong message? Wait until the page has finished loading, click in the address bar and then press the Enter key. This is a timing bug in some browsers.
50th message | this message only posted: 25 Apr 2020 13:46
 PM  Reply with quote  Reply blank 
from:
DerekStuart
United Kingdom

 

view images in gallery
view images as slides
Hello Martin
Please never under-estimate how highly you are regarded. Don't forget if you type a response to one person, perhaps 100s will read it- either there and then or it's forever cached in search engines.

Sadly a lot of people don't really acknowledge the help they've been given; indeed, I tend to find when talking to people I 'know' a bit better that it's easier to thank them during your next post rather than have a forum full of 'thanks', 'you're welcome' and 'thanks again.' I'm sure I'm not the only one and that can often make it appear unacknowledged.


Anyway, on that subject... I am getting on quite well with the databases, indeed it's been at least a few hours since I threatened to throw the PC out the window. I jest, it's just an issue of getting out of the MS Access/ VBA habit and into a different discipline.

One thing I'm finding a blank with is basic on form data handling. I have followed a tutorial for building a calculator and it works, but I've tried to 'pick the bones' out of it to come up with a simple 'add one box to another', but I can't see why it's working. Like the database, if I can break the back of one problem it seems expanding from there on is easy. Any ideas, please?


var
Form1: TForm1;
Value1: Integer;
Value2: Integer;
Value3: Integer;

implementation

{$R *.lfm}

{ TForm1 }

procedure TForm1.Button1Click(Sender: TObject);
begin
{ Box3.Caption := Box1.Caption + Box2.Caption;}
{ Value1 := Box1.Caption;
Value2 := Box2.Caption;
Value3 = Value1 + Value2;}

Box1.Caption := StrtoInt (Value1);
Box2.Caption := StrtoInt (Value2);
Value3 := Value1 + Value2;
Box3.Caption := Value3;
end;



OSM? That's the open source mapping system, I believe. Funny enough I have just been playing about with something very similar- trying to plot a database of GPS co-ordinates on a google map (that database unsurprisingly is destined to be fed by a GPS sender unit). As for the 'Boris walk', it's funny how you start noticing things you don't normally notice- I found myself staring at a piece of an old wall when in Tesco trying to work out if it was part of Towcester's old railway station. (I concluded it was part of the original adjacent foundry). Sorry, I waffle on- another lockdown bad habit.

Derek
__________
message ref: 29385

 
 Clicked a link? Wrong message? Wait until the page has finished loading, click in the address bar and then press the Enter key. This is a timing bug in some browsers.
51st message | this message only posted: 25 Apr 2020 14:40
 PM  Reply with quote  Reply blank 
from:
Martin Wynne
West Of The Severn, United Kingdom



view images in gallery
view images as slides

Please do not send requests for help direct to me via email or PM.

Post your questions on the forum where everyone can see them and add helpful replies.
Derek, thanks again for the kind words.

try
  Value1:=StrToInt(Box1.Caption);
  Value2:=StrToInt(Box2.Caption);
except
  ShowMessage('error: boxes must contain whole numbers only, no decimal point or other characters');
  EXIT;
end;


Then you need the IntToStr function, not StrToInt:

Box1.Caption := StrtoInt (Value1);
Box2.Caption := StrtoInt (Value2);
Box3.Caption := Value3;


Box1.Caption := IntToStr(Value1);
Box2.Caption := IntToStr(Value2);
Box3.Caption := IntToStr(Value3);

But what are those boxes? If they are TEdit controls, you need Box1.Text etc., not .Caption.

Caption isn't usually editable by the user.

Yes, OSM:

 https://www.openstreetmap.org

Don't ever register on there as a mapper. It will take over your life. There is no end to it as you go around your local area. Is that posting box shown in exactly the right place? Does it have the right ref number in the database? Last collection time? Now then, about the bus stops...

That old broken stile has recently been replaced with a kissing gate... And is that a fence or a hedge or bits of both...

Now I'm waffling too. :)

cheers,

Martin.

__________
message ref: 29386

 
 Clicked a link? Wrong message? Wait until the page has finished loading, click in the address bar and then press the Enter key. This is a timing bug in some browsers.
52nd message | this message only posted: 26 Apr 2020 13:56
 PM  Reply with quote  Reply blank 
from:
DerekStuart
United Kingdom

 

view images in gallery
view images as slides
Marvelous, thanks Martin.

I can see I was invoking VBA type expressions and couldn't spot it no matter how many times I read and re-read it. You were of course right about caption Vs text; I changed to TEdit boxes but didn't update it and the debugger didn't get as far as warning me before crashing over the above issues.

Last night I managed to 'translate' variables to and from date forms and store variables across forms too.

Much like my 2 questions on Freepascal forum, once you crack the basic syntax of something, working the rest out becomes easy. After reading your answer last night, I now have a *rudimentary* double entry book keeping programme, managing accounts, suppliers, customers and purchases. Only basic, but it's a "proving" concept. I think I've probably crammed into a couple of months what should take a couple of years, and that's in no small way due to your help and encouragement.

Given the time you spend on Templot, the forum, RMW, and now mapping- how do you find time to lead a life? I will be looking at OSM for this project in due course; I have experimented with Google maps, but although it's free for what I want to use, I don't like being at the 'mercy' of Google, nor relying on its APIs.

Now, I've just downloaded a demo PHP server to see if I can integrate a website with my database...

Thanks again Martin. I'm achieving something practical AND having fun. Mostly!

Derek
__________
message ref: 29393

 
 Clicked a link? Wrong message? Wait until the page has finished loading, click in the address bar and then press the Enter key. This is a timing bug in some browsers.
53rd message | this message only posted: 10 May 2020 21:50
 PM  Reply with quote  Reply blank 
from:
Mike Kynaston
United Kingdom

 

view images in gallery
view images as slides
Hi Martin,
I have been looking round for a programming system to use on the PC, and came across this thread. Is it the Community Edition that you use for Templot or have you purchased the full blown edition?

I am interested in writing some software to control some operations on a DCC layout, and having a good background in Network design, Visual Basic, Python and PHP (god I even go back to Spectrum 64 basic!) I don't think Delphi should be beyond me, as long as I can figure out communications with the COM ports.

Mike
__________
message ref: 29608

 
 Clicked a link? Wrong message? Wait until the page has finished loading, click in the address bar and then press the Enter key. This is a timing bug in some browsers.
54th message | this message only posted: 10 May 2020 22:14
 PM  Reply with quote  Reply blank 
from:
Martin Wynne
West Of The Severn, United Kingdom



view images in gallery
view images as slides

Please do not send requests for help direct to me via email or PM.

Post your questions on the forum where everyone can see them and add helpful replies.
Mike Kynaston wrote:I have been looking round for a programming system to use on the PC, and came across this thread. Is it the Community Edition that you use for Templot or have you purchased the full blown edition?Hi Mike,

I strongly advise against the Delphi Community Edition. It seems to be just a marketing exercise by Embarcadero. You will get endless nagging emails from them to buy the very expensive full version, even hinting that you are using the Community Edition outside the licence conditions. And there is no guarantee that the licence will be renewed after the first 12 months.

If you are looking to do a bit of coding, I suggest Lazarus. Free and open-source:

 https://www.lazarus-ide.org/

It's a clone of early versions of Delphi. For Templot2 I use a very early version, Delphi5 from 1998. :)

Templot3 is coded in Lazarus:

  https://sourceforge.net/projects/opentemplot/

To try running Templot3, click the T3 menu in Templot.

For a guide to getting started in Lazarus, see:

 http://85a.co.uk/forum/view_topic.php?id=3283&forum_id=8

p.s. I have turned you green, so that you can see this forum section:

 http://85a.co.uk/forum/view_forum.php?id=26

Anyone else? See:

 http://85a.co.uk/forum/view_topic.php?id=3539&forum_id=1

cheers,

Martin.

__________
message ref: 29609

 
 Clicked a link? Wrong message? Wait until the page has finished loading, click in the address bar and then press the Enter key. This is a timing bug in some browsers.
55th message | this message only posted: 12 May 2020 03:53
 PM  Reply with quote  Reply blank 
from:
DerekStuart
United Kingdom

 

view images in gallery
view images as slides
Hello Mike
I am well below Martin's ability, but like you, I am new to the idea of a Pascal language.

I really started this seriously only a few months ago and now I would say I'm about 90-95% of the way there with database management using Lazarus; I specifically chose this discipline as that's what I needed and there are areas of Pascal that I'm still really learning.

It's incredibly addictive. Here it is now 03:49 on Tuesday morning and I've just stopped from "...I wonder if I change this, will it do that..."

I came from a moderate level of VBA, using it to turbo-charge MS Access in the past. As part of my Pascal/Lazarus learning I have had to master PHP (a beautiful and simple language), brush up on javascript and refresh html.

Lazarus is, IMO, now a little bit of a poor relation to Delphi, but as Martin says I would absolutely steer clear of the Delphi community edition. It has a number of restrictions and muggins here was trying to work out why I had so many compile errors, only to realise that it's a restricted version.

I'd encourage you to download and try Lazarus. I am nowhere near Martin's level, but I am happy to help as I know what it's like for a beginner. I have a list of documents (mostly thanks to Martin) and several websites I've found.

Good luck. But remember it's addictive.
Derek
__________
message ref: 29636

 
 Clicked a link? Wrong message? Wait until the page has finished loading, click in the address bar and then press the Enter key. This is a timing bug in some browsers.
56th message | this message only posted: 12 May 2020 13:55
 PM  Reply with quote  Reply blank 
from:
Mike Kynaston
United Kingdom

 

view images in gallery
view images as slides
Martin,
Thanks for the heads up on Lazaraus, I have downloaded it, so will have a look, and will take a look at your Getting Started guide. Thanks.

Mike
__________
message ref: 29643

 
 Clicked a link? Wrong message? Wait until the page has finished loading, click in the address bar and then press the Enter key. This is a timing bug in some browsers.
57th message | this message only posted: 12 May 2020 14:01
 PM  Reply with quote  Reply blank 
from:
Mike Kynaston
United Kingdom

 

view images in gallery
view images as slides
DerekStuart wrote: Hello Mike
I am well below Martin's ability, but like you, I am new to the idea of a Pascal language.

I really started this seriously only a few months ago and now I would say I'm about 90-95% of the way there with database management using Lazarus; I specifically chose this discipline as that's what I needed and there are areas of Pascal that I'm still really learning.

It's incredibly addictive. Here it is now 03:49 on Tuesday morning and I've just stopped from "...I wonder if I change this, will it do that..."

I came from a moderate level of VBA, using it to turbo-charge MS Access in the past. As part of my Pascal/Lazarus learning I have had to master PHP (a beautiful and simple language), brush up on javascript and refresh html.

Lazarus is, IMO, now a little bit of a poor relation to Delphi, but as Martin says I would absolutely steer clear of the Delphi community edition. It has a number of restrictions and muggins here was trying to work out why I had so many compile errors, only to realise that it's a restricted version.

I'd encourage you to download and try Lazarus. I am nowhere near Martin's level, but I am happy to help as I know what it's like for a beginner. I have a list of documents (mostly thanks to Martin) and several websites I've found.

Good luck. But remember it's addictive.
Derek
Hi Derek,
Thanks for the info, much appreciated.  Yes, the database side of things will be critical for what I am thinking.  I grew up in a BASIC environment, starting with a Spectrum, the Commadore 64 and later Amiga, moved to PCs and taught myself Visual Basic, then ASP and moved to PHP when ASP.Net came in, and known the basics of JavaScript.  Did do machine code for a while at one time too!  I've looked at Csharp in the past, but not to the level of being comfortable with it.  

I have been playing with the Community (free) version of VisualStudio2019.NET which has possibilities for me too.  My core requirements are to be able to communicate with and listen to the COM port, to pick Loconet packages, but also to be able to communicate with a CAN bus - as a member of MERG I am looking forward to the simplicities of CAN, which brings a lot of power in small easy packages.  But I need the PC software to tie everything together - I was thinking that Delphi, or Lazarus, might be a better option than VS2019, so a bit of testing and learning needs to be done I think!

Mike

__________
message ref: 29644

 
 Clicked a link? Wrong message? Wait until the page has finished loading, click in the address bar and then press the Enter key. This is a timing bug in some browsers.
58th message | this message only posted: 11 Dec 2020 08:44
 PM  Reply with quote  Reply blank 
from:
Martin Wynne
West Of The Severn, United Kingdom



view images in gallery
view images as slides

Please do not send requests for help direct to me via email or PM.

Post your questions on the forum where everyone can see them and add helpful replies.
Returning to this topic to say that Embarcadero have just now posted a new Object Pascal Guide as a free download:

 https://lp.embarcadero.com/Object-Pascal-Handbook-2021?utm_source=whitepaper&utm_medium=email&utm_content=ObjectPascalHandbook2021

It includes the latest Delphi changes, but the basics should be the same as always. A lot of it (but not all) should apply equally to Lazarus.

cheers,

Martin.

__________
message ref: 31540

 
 Clicked a link? Wrong message? Wait until the page has finished loading, click in the address bar and then press the Enter key. This is a timing bug in some browsers.
59th message | this message only posted: 12 Dec 2020 02:48
 PM  Reply with quote  Reply blank 
from:
DerekStuart
United Kingdom

 

view images in gallery
view images as slides
That's an interesting manual, thanks for sharing the link with us. It's one of those written in an easy to follow style (many aren't) and after several months without trying, it's very easy to forget how to do the basics, though I'm pleased the database controls came back to me very quickly.

One of the things I was experimenting with before I temporarily gave up is importing GPS data from a database (simulating a tracker's output) and trying to plot it on a map. Have you ever tried anything like that before or is there anything you can suggest to point me in the right direction?

It's not that I'm desperate to tackle complicated jobs yet, but having the knowledge it can be done eventually is useful.

A nice little Christmas job to re-read that book.

All the best
Derek
__________
message ref: 31545

 
 Clicked a link? Wrong message? Wait until the page has finished loading, click in the address bar and then press the Enter key. This is a timing bug in some browsers.
60th message | this message only posted: 12 Dec 2020 10:24
 PM  Reply with quote  Reply blank 
from:
Martin Wynne
West Of The Severn, United Kingdom



view images in gallery
view images as slides

Please do not send requests for help direct to me via email or PM.

Post your questions on the forum where everyone can see them and add helpful replies.
DerekStuart wrote: One of the things I was experimenting with before I temporarily gave up is importing GPS data from a database (simulating a tracker's output) and trying to plot it on a map. Have you ever tried anything like that before or is there anything you can suggest to point me in the right direction?
Hi Derek,

A popular format for recording GPS tracking data is in GPX files (*.gpx). There are lots of programs available for analysis, editing and plotting of GPX files.

GPX files are text-based, in XML format, so it's quite easy to parse and extract data from them in your own code.

More about the GPX format:

 https://www.topografix.com/gpx.asp

Details of the XML Schema for GPX:

 http://www.topografix.com/GPX/1/1/

Here's one of mine, opened in *Notepad++



trkpt is a single track point, and you can see it's easy to extract the latitude and longitude figures. I can post a bit of code showing how to do that if you wish?

Converting the lat and lon to X,Y co-ordinates for plotting on a screen map at different zoom levels is the tricky bit, involving some maths.

You can enter lat and lon directly in OSM to find the map location:




Note that for most of the UK, longitude is negative.

To get some GPX files to play with, click the GPS Traces link above.

*Notepad++ is the essential (free) text editor for programmers:

 https://notepad-plus-plus.org/

cheers,

Martin.

__________
message ref: 31546

 
 Clicked a link? Wrong message? Wait until the page has finished loading, click in the address bar and then press the Enter key. This is a timing bug in some browsers.
61st message | this message only posted: 12 Dec 2020 16:36
 PM  Reply with quote  Reply blank 
from:
DerekStuart
United Kingdom

 

view images in gallery
view images as slides
Hello Martin, thank you for the info.

If I've understood the process correctly:
- I use a GPS device, which I instruct where to output its data
- Say I have a server, presumably it ends in a database, which I must design
- I then convert ('parse') the data from the native format of the device to the native format of the mapping system.
- Then I would embed a map into the programme (easy enough, I think) and then by some coding magic, I import the data from the database onto map.

Once I've got to that stage, then I could set up waypoints, such as 'Martin's Town' starting from Lat1-Lat2/ Lon1-Lon2 and any trace within that location could be triggered to say "GPS1 just drove through Martin's Town", for example?


I'm not sure if I mentioned this before (probably) but I originally set out to write some software for a specific task that is badly lacking in my industry; it's not for a commission, it's purely private to prove a point. Most of it is just a basic database anyway, but things like GPS are a bit specialist.

I'll take your offer to show how to parse the data, thank you, but I need to learn a bit more of the basics before I get to that point; I was more interested at this stage to see if it can be done- which it seems it can.

Thanks
Derek
__________
message ref: 31547

 
 Clicked a link? Wrong message? Wait until the page has finished loading, click in the address bar and then press the Enter key. This is a timing bug in some browsers.
62nd message | this message only posted: 12 Dec 2020 19:36
 PM  Reply with quote  Reply blank 
from:
Martin Wynne
West Of The Severn, United Kingdom



view images in gallery
view images as slides

Please do not send requests for help direct to me via email or PM.

Post your questions on the forum where everyone can see them and add helpful replies.
DerekStuart wrote: Once I've got to that stage, then I could set up waypoints, such as 'Martin's Town' starting from Lat1-Lat2/ Lon1-Lon2 and any trace within that location could be triggered to say "GPS1 just drove through Martin's Town", for example?
Hi Derek,

We seem to be getting two different things muddled up. :?

This is what I do and could possibly help with:

1. I take my GPS device (Satmap Active 20) out with me. At some stage I switch it to start tracking, and it records my movements until I switch tracking off. With or without tracking on, it shows me where I am on the map, and it shows the track I made as a string of red dots on the map.

2. when I get home, I transfer the tracking record, as a GPX file, from the Satmap to my computer.

3. on the computer, I use the data in the GPX to plot my route on a map. I can do that manually, or use my own program, or use other software to import the GPX and display the track on a map. (I can also use the time records in the GPX to correlate with the time recorded for my photographs, and get the geographical location for each photo.)

What you seem to want is:

1. attach a GPS tracking device to a moving object.

2. it continuously transmits its live position to a receiver.

3. at the receiver the position is shown live on a map, or used for some other purpose.

I'm sorry, I don't know anything about that process, or what data formats are used. I would be interested to learn more.

But there are dozens of commercial applications which can do that. They are used for example by online delivery services such as Amazon to show you where their driver is and how many stops away from reaching you. One such is:

 https://kiffgo.com/

(I know nothing about it, it was just the first result on Google.)

There are similar personal apps which can be installed on mobile phones, and transmit your location back home for emergencies, etc.

Generally, if something is already being done, I don't have a great interest in re-inventing someone else's wheel. That's why I spend my time mostly on Templot where there is nothing else comparable on Earth. :)

cheers,

Martin.

__________
message ref: 31548

 
 Clicked a link? Wrong message? Wait until the page has finished loading, click in the address bar and then press the Enter key. This is a timing bug in some browsers.
63rd message | this message only posted: 12 Dec 2020 20:47
 PM  Reply with quote  Reply blank 
from:
Rob Manchester
Manchester, United Kingdom



view images in gallery
view images as slides
Hi Derek,

I seem to remember seeing something on drone websites that sounds like what you want to do - maybe worth a look. There are also many farmers with fancy modern tractors that are GPS controlled so they can plough, sow and harvest without having to steer the tractor/combine manually.

As Martin points out delivery companies can have live maps that show you where the van is and when it is going to arrive with you. I buy a lot of my things from companies that use DPD for delivery and they have now stopped using the live map and just tell you what parcel number the driver is currently working on and how long he will be before arriving at your place. Maybe that were getting hijacked too often :(

Rob


__________
message ref: 31549

 
 Clicked a link? Wrong message? Wait until the page has finished loading, click in the address bar and then press the Enter key. This is a timing bug in some browsers.
64th message | this message only posted: 12 Dec 2020 21:23
 PM  Reply with quote  Reply blank 
from:
Martin Wynne
West Of The Severn, United Kingdom



view images in gallery
view images as slides

Please do not send requests for help direct to me via email or PM.

Post your questions on the forum where everyone can see them and add helpful replies.
Rob Manchester wrote: There are also many farmers with fancy modern tractors that are GPS controlled so they can plough, sow and harvest without having to steer the tractor/combine manually.
Hi Rob,

It's made a noticeable difference to the countryside in just the last few years -- fields filled with perfectly parallel straight lines and perfectly concentric curves:



No doubt we will soon have GPS-generated crop circles. :)

Martin.

__________
message ref: 31550

 
 Clicked a link? Wrong message? Wait until the page has finished loading, click in the address bar and then press the Enter key. This is a timing bug in some browsers.
65th message | this message only posted: 12 Dec 2020 21:43
 PM  Reply with quote  Reply blank 
from:
Rob Manchester
Manchester, United Kingdom



view images in gallery
view images as slides
Martin,

Thanks for the picture. Potatoes ? The picture shows how important lighting is to a picture - compare the crispness of the left half of the soil with that on the right.

Rob


__________
message ref: 31551

 
 Clicked a link? Wrong message? Wait until the page has finished loading, click in the address bar and then press the Enter key. This is a timing bug in some browsers.
66th message | this message only posted: 12 Dec 2020 21:54
 PM  Reply with quote  Reply blank 
from:
Martin Wynne
West Of The Severn, United Kingdom



view images in gallery
view images as slides

Please do not send requests for help direct to me via email or PM.

Post your questions on the forum where everyone can see them and add helpful replies.
Hi Rob,

Yes, potatoes. Coming soon to a packet of crisps near you. :)

Martin.

__________
message ref: 31552

 
 Clicked a link? Wrong message? Wait until the page has finished loading, click in the address bar and then press the Enter key. This is a timing bug in some browsers.
67th message | this message only posted: 12 Dec 2020 22:58
 PM  Reply with quote  Reply blank 
from:
Rob Manchester
Manchester, United Kingdom



view images in gallery
view images as slides
Martin Wynne wrote: Hi Rob,

Yes, potatoes. Coming soon to a packet of crisps near you. :)

Martin.
Martin,
Good job - I eat lots of crisps, usually Bovril, Salt&Vinegar and plain( with a little salt sachet ). I am rather partial to Twiglets too....

I hope the farmers have New Holland tractors ( made in UK even if they are run by an Italian ) otherwise they will start putting Brexit tax on my crisps.

Rob


__________
message ref: 31555

 
 Clicked a link? Wrong message? Wait until the page has finished loading, click in the address bar and then press the Enter key. This is a timing bug in some browsers.
68th message | this message only posted: 18 Dec 2020 19:04
 PM  Reply with quote  Reply blank 
from:
DerekStuart
United Kingdom

 

view images in gallery
view images as slides
Thanks Martin
I've made a bit of a breakthrough in understanding the codes necessary to understand GPS output.

As far as I can see, standalone GPS trackers use a format known as NMEA and the output comes out like this:

$GPGGA,185259.858,5131.860,N,00007.412,W,1,12,1.0,0.0,M,0.0,M,,*73
$GPGSA,A,3,01,02,03,04,05,06,07,08,09,10,11,12,1.0,1.0,1.0*30
$GPRMC,185259.858,A,5131.860,N,00007.412,W,,,181220,000.0,W*6F

This is the location of the passenger footbridge at Kings Cross, platform 8.

Although I don't know how to do it- yet- I'm sure when the time comes, parsing this into the format required by a map won't be a problem. You were dead right in what you once said to me- this is addictive once you get on a roll.


Rob,
There aren't enough Twiglets on planet Earth for the both of us. I suggest instead we just collect small tree branches and dip them in Marmite.

Derek

EDIT: Clarification: As I understand it NMEA is the standard method of GPS operation for the USA's system and how some/ many GPS units work internally; this does not necessarily mean they output in this format to the end user. 



__________
message ref: 31604

 
 Clicked a link? Wrong message? Wait until the page has finished loading, click in the address bar and then press the Enter key. This is a timing bug in some browsers.
69th message | this message only posted: 18 Dec 2020 19:22
 PM  Reply with quote  Reply blank 
from:
Rob Manchester
Manchester, United Kingdom



view images in gallery
view images as slides
Derek,

I assume you are refering to the Mr Bean version of Twiglets ! They are a bit chewy for my poor teeth :(

I could empty the loose bits from the bottom of Twiglets bags all day long. Look out for the Christmas drums of them on special offer in the supermarket.

Rob


__________
message ref: 31606

 
 Clicked a link? Wrong message? Wait until the page has finished loading, click in the address bar and then press the Enter key. This is a timing bug in some browsers.
70th message | this message only posted: 19 Dec 2020 19:03
 PM  Reply with quote  Reply blank 
from:
DerekStuart
United Kingdom

 

view images in gallery
view images as slides
Rob,

I have seen those drums of Twiglets already. I DID have a drum of them somewhere last Friday- but now I have only an empty drum and an empty bottle of rum next to it.

I have no idea what happened. Must have been Father Christmas and his damned reindeers.

Derek
__________
message ref: 31609

 
This is topic ID = 3607     Page created at 06:53 (local time) Page:  First Page Previous Page  1  2     
You can type a quick reply to this topic here.

Click in the box to begin.


But to reply to an individual message, or to include images, attachments and formatted text, use the reply buttons on each message above.

To start a new topic in this forum, click the Start new topic button below.
To start a new topic in a different forum, click the Forum Jump drop-down list below.

             Start new topic 

 click to jump to a different forum:     Back to top of page

Templot Club > Forums > Off track > Making sense of program code in Lazarus
about Templot Club

list recently active topics Templot Companion - User Guide - A-Z Index Templot Explained for beginners Please click: important information for new members and first-time visitors.
indexing link for search engines

back to top of page


Please read this important note about copyright: Unless stated otherwise, all the files submitted to this web site are copyright and the property of the respective contributor. You are welcome to use them for your own personal non-commercial purposes, and in your messages on this web site. If you want to publish any of this material elsewhere or use it commercially, you must first obtain the owner's permission to do so.

The small print: All material submitted to this web site is the responsibility of the respective contributor. By submitting material to this web site you acknowledge that you accept full responsibility for the material submitted. The owner of this web site is not responsible for any content displayed here other than his own contributions. The owner of this web site may edit, modify or remove any content at any time without giving notice or reason.
Problems with this web site? Contact webmaster@templot.com.   This web site uses cookies: click for information.  
© 2020  

Powered by UltraBB - © 2009 Data 1 Systems