Collecting USB GPS data

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Anzwertree
Posts: 10
Joined: Sat Aug 22, 2009 6:48 am

Collecting USB GPS data

Post by Anzwertree » Tue Apr 26, 2011 2:29 am

Okay, I already posted this question once before on the beginners forum. One other person replied, but so far no skilled professionals have jumped in yet. And so, I decided to repost ny question here, hoping someone else might have insight into this question.

Original post:
I'm a hobbyist programmer. For a living I do a lot of road traveling. I am curious. Is there a way to access GPS data from LiveCode somehow? There are a lot of things I could do to make my life a lot easier if there was a way to keep track of my location in a car using GPS. I'm not interested in directions, just the current location of where I am -- city, state, county, etc. I'm sure there isn't a native way to do this. But what kind of hack could I do? If I was going to target a specific system, it would be Windows based workstations. For instance, there are commercial USB GPS devices that simply plug into your computer. That's what I want to do. I want to be able to grab accurate information about my location. If I could do that, there's a virtual endless amount of opportunities for me. Any suggestions?


I will try and delete the old post if I can. This is more of an advanced question, anyway. Please let me know if you have any potential solutions for this problem. I do not need step by step instructions. I just need to be pointed in the right direction.

Anzwertree
Posts: 10
Joined: Sat Aug 22, 2009 6:48 am

Re: Collecting USB GPS data

Post by Anzwertree » Tue Apr 26, 2011 10:34 pm

Okay, I have discovered a workaround for this. If you are interested, then listen up. There does not appear to be a way to do this from LiveCode directly. You must use Java or another language capable of interfacing with a USB GPS device. While there might possibly by a way I've looked over, I have not found anything suggesting the possibility. However, this is still possible using another programming language to set up the resources for LiveCode to use.

mhoneywill
Posts: 66
Joined: Fri Feb 05, 2010 7:31 pm

Re: Collecting USB GPS data

Post by mhoneywill » Wed Apr 27, 2011 1:55 pm

I'm no Livecode expert, but does your USB GPS device appear as a Serial port on your computer? if so Livecode should be able to talk to it.

Do you have a part number for the GPS device you are using?

Anzwertree
Posts: 10
Joined: Sat Aug 22, 2009 6:48 am

Re: Collecting USB GPS data

Post by Anzwertree » Thu Apr 28, 2011 4:02 am

I haven't gotten one yet. I want to be sure when I buy one, that I'll be getting one that will work with my project. I need more time to research.

mhoneywill
Posts: 66
Joined: Fri Feb 05, 2010 7:31 pm

Re: Collecting USB GPS data

Post by mhoneywill » Thu Apr 28, 2011 7:28 pm

When you have an idea of the type of USB GPS you want to buy post the details here, and someone (me if I see the post) can maybe see if they can find any details out about it. If it apears as a serial port to the PC / Mac then it should work with LC (no promises though). See http://en.wikipedia.org/wiki/NMEA_0183

Anzwertree
Posts: 10
Joined: Sat Aug 22, 2009 6:48 am

Re: Collecting USB GPS data

Post by Anzwertree » Fri Apr 29, 2011 1:19 am

Thanks a lot, bro! LiveCode is super fun. I'm just glad I know a few other languages or I'd of been stuck here for awhile. Back when I first started programming, I always wondered how different languages could come together for a project, or what programmers meant by "only knowing one language," is not enough to be productive. I never really understood that at first. Now, almost 10 years later, it all makes perfect sense. Last night I borrowed my friend's GPS receiver. It took me about half an hour to write a custom Python script for extracting the data I needed and then putting it into a SQLite database file. That same file can be used with my LiveCode programs because LiveCode comes built in with database support. If I wanted to share my program, I would need to include the script I wrote with Python (which could be compiled into an executable for Mac or Windows). Then it is simply a matter of programming your LiveCode application to launch the resource file you created. The SQLite database could be modified this way each time, seemingly transparent. To the end user, it only appears they are using one program, when in reality they are using at least two -- the LiveCode application and the python script. At any point when something may or may not be supported by LiveCode, there are other languages that might be able to help. In this case, it worked out perfect. I didn't have to track down the functionality for LiveCode. I already knew how to do it with Python. But it was actually SQLite that made it possible, because LiveCode comes built in with SQLite support. LiveCode might be able to do it, but unfortunately, LiveCode suffers a little with documentation.

There are some good tutorials, but there are no real structured paths for beginners to take. You're sort of lost in a sea of scattered documentation. That's not too uncommon, though. It just doesn't help when you are looking for something very specific. You pretty much have to read through everything RunRev has provided and figure out how to use the information on your own. That's not so bad for me because I've been programming awhile. Someone completely new to programming would have a deep learning curve here, however. And that's unfortunate because LiveCode really is easier than anything else. The difference is that the more complicated languages out there have much, much better documentation than LiveCode at the moment. That is perhaps my biggest criticism thus far.

The LiveCode scripting language is pretty much a mystery to any new person, and there's really no good thorough introduction to it anywhere that I've found. You just have to do it the very boring way. Read the very well documented dictionary. Yes, they did a great job documenting their dictionary. Much better than some other more complicated languages. Unfortunately, reading a dictionary is a really slow and extremely boring way to learn a new language. I've done it before, it just takes a long, long time through trial and error. I think LiveCode could be much more successful if there was an actual textbook for the LiveCode scripting language. RunRev shouldn't just expect people to read an old version of some book that the LiveCode scripting language was based on. A new book should be written for this generation and specific to LiveCode. The included User Guide is not what I'm talking about.

Post Reply