GPS / Longitude / Latitude library
Hi, Does anyone know of a library for processing GPS coordinates? What I'm looking for are things like: - Parsing from and printing to various string formats (HMS, NESW, decimal) - Distance between two points - etc. Thanks, Alistair
Hi Alistair,
On 4 Dec 2018, at 10:21, Alistair Grant <akgrant0710@gmail.com> wrote:
Hi,
Does anyone know of a library for processing GPS coordinates?
What I'm looking for are things like:
- Parsing from and printing to various string formats (HMS, NESW, decimal) - Distance between two points - etc.
Thanks, Alistair
We've got some elementary stuff based on WGS84 coordinates as points. For example, T3GeoTools distanceBetween: 5.33732@50.926 and: 5.49705@50.82733. T3GeoTools bearingFrom: 5.33732@50.926 to: 5.49705@50.82733. T3GeoTools destinationFrom: 5.33732@50.926 bearing: 45 distance: 2500. T3GeoTools centroidOf: { 5.48230@50.82249. 5.49523@50.81288. 5.50138@50.82008. 5.50228@50.82595. 5.49265@50.82560. 5.48230@50.82249 }. T3GeoTools is: 5.33732@50.92601 inside: { 5.48230@50.82249. 5.49523@50.81288. 5.50138@50.82008. 5.50228@50.82595. 5.49265@50.82560. 5.48230@50.82249 }. This is not open source, but it is not rocket science either (just implementations of public algorithms). We have less need for special conversions, we do them case by case when they occur. What are you planning to do ? Sven
Hi Sven, Thanks. This is just for me playing around with my photo collection, i.e. find all photos from a particular location, i.e. within a specified distance of a point. Also maybe add GPS coordinates to some photos. Thanks again, Alistair On Tue, 4 Dec 2018 at 11:04, Sven Van Caekenberghe <sven@stfx.eu> wrote:
Hi Alistair,
On 4 Dec 2018, at 10:21, Alistair Grant <akgrant0710@gmail.com> wrote:
Hi,
Does anyone know of a library for processing GPS coordinates?
What I'm looking for are things like:
- Parsing from and printing to various string formats (HMS, NESW, decimal) - Distance between two points - etc.
Thanks, Alistair
We've got some elementary stuff based on WGS84 coordinates as points. For example,
T3GeoTools distanceBetween: 5.33732@50.926 and: 5.49705@50.82733. T3GeoTools bearingFrom: 5.33732@50.926 to: 5.49705@50.82733. T3GeoTools destinationFrom: 5.33732@50.926 bearing: 45 distance: 2500. T3GeoTools centroidOf: { 5.48230@50.82249. 5.49523@50.81288. 5.50138@50.82008. 5.50228@50.82595. 5.49265@50.82560. 5.48230@50.82249 }. T3GeoTools is: 5.33732@50.92601 inside: { 5.48230@50.82249. 5.49523@50.81288. 5.50138@50.82008. 5.50228@50.82595. 5.49265@50.82560. 5.48230@50.82249 }.
This is not open source, but it is not rocket science either (just implementations of public algorithms).
We have less need for special conversions, we do them case by case when they occur.
What are you planning to do ?
Sven
Interesting. Iâm interested with such tools too. I ask students to do gps point collection from mobile (Cordova) and process them in pharo to detect if they enter known places. I wonder if a proper gps point class would be useful. Iâd like to record also the precision. Cheers, Cedrick
Le 4 déc. 2018 à 11:15, Alistair Grant <akgrant0710@gmail.com> a écrit :
Hi Sven,
Thanks. This is just for me playing around with my photo collection, i.e. find all photos from a particular location, i.e. within a specified distance of a point. Also maybe add GPS coordinates to some photos.
Thanks again, Alistair
On Tue, 4 Dec 2018 at 11:04, Sven Van Caekenberghe <sven@stfx.eu> wrote:
Hi Alistair,
On 4 Dec 2018, at 10:21, Alistair Grant <akgrant0710@gmail.com> wrote:
Hi,
Does anyone know of a library for processing GPS coordinates?
What I'm looking for are things like:
- Parsing from and printing to various string formats (HMS, NESW, decimal) - Distance between two points - etc.
Thanks, Alistair
We've got some elementary stuff based on WGS84 coordinates as points. For example,
T3GeoTools distanceBetween: 5.33732@50.926 and: 5.49705@50.82733. T3GeoTools bearingFrom: 5.33732@50.926 to: 5.49705@50.82733. T3GeoTools destinationFrom: 5.33732@50.926 bearing: 45 distance: 2500. T3GeoTools centroidOf: { 5.48230@50.82249. 5.49523@50.81288. 5.50138@50.82008. 5.50228@50.82595. 5.49265@50.82560. 5.48230@50.82249 }. T3GeoTools is: 5.33732@50.92601 inside: { 5.48230@50.82249. 5.49523@50.81288. 5.50138@50.82008. 5.50228@50.82595. 5.49265@50.82560. 5.48230@50.82249 }.
This is not open source, but it is not rocket science either (just implementations of public algorithms).
We have less need for special conversions, we do them case by case when they occur.
What are you planning to do ?
Sven
As Dershowitz and Reingold showed in their book "Calendrical Calculations", converting from UTC to several calendars needs latitude, longitude, and elevation. ISO 6709 is the relevant standard: https://en.wikipedia.org/wiki/ISO_6709 On Tue, 4 Dec 2018 at 23:35, Cédrick Béler <cdrick65@gmail.com> wrote:
Interesting.
Iâm interested with such tools too.
I ask students to do gps point collection from mobile (Cordova) and process them in pharo to detect if they enter known places.
I wonder if a proper gps point class would be useful. Iâd like to record also the precision.
Cheers,
Cedrick
Le 4 déc. 2018 à 11:15, Alistair Grant <akgrant0710@gmail.com> a écrit :
Hi Sven,
Thanks. This is just for me playing around with my photo collection, i.e. find all photos from a particular location, i.e. within a specified distance of a point. Also maybe add GPS coordinates to some photos.
Thanks again, Alistair
On Tue, 4 Dec 2018 at 11:04, Sven Van Caekenberghe <sven@stfx.eu> wrote:
Hi Alistair,
On 4 Dec 2018, at 10:21, Alistair Grant <akgrant0710@gmail.com> wrote:
Hi,
Does anyone know of a library for processing GPS coordinates?
What I'm looking for are things like:
- Parsing from and printing to various string formats (HMS, NESW, decimal) - Distance between two points - etc.
Thanks, Alistair
We've got some elementary stuff based on WGS84 coordinates as points. For example,
T3GeoTools distanceBetween: 5.33732@50.926 and: 5.49705@50.82733. T3GeoTools bearingFrom: 5.33732@50.926 to: 5.49705@50.82733. T3GeoTools destinationFrom: 5.33732@50.926 bearing: 45 distance: 2500. T3GeoTools centroidOf: { 5.48230@50.82249. 5.49523@50.81288. 5.50138@50.82008. 5.50228@50.82595. 5.49265@50.82560. 5.48230@50.82249 }. T3GeoTools is: 5.33732@50.92601 inside: { 5.48230@50.82249. 5.49523@50.81288. 5.50138@50.82008. 5.50228@50.82595. 5.49265@50.82560. 5.48230@50.82249 }.
This is not open source, but it is not rocket science either (just implementations of public algorithms).
We have less need for special conversions, we do them case by case when they occur.
What are you planning to do ?
Sven
Hi Pierce & Richard, Thanks for your replies. On Wed, Dec 05, 2018 at 10:24:18AM +0800, Pierce Ng wrote:
On Tue, Dec 04, 2018 at 10:21:20AM +0100, Alistair Grant wrote:
Does anyone know of a library for processing GPS coordinates?
What I'm looking for are things like:
- Parsing from and printing to various string formats (HMS, NESW, decimal) - Distance between two points - etc.
SQLite-based possibilities:
- Spatialite: https://www.gaia-gis.it/fossil/libspatialite/index - R*Tree: https://sqlite.org/rtree.html - GeoPoly: https://sqlite.org/geopoly.html
On Wed, Dec 05, 2018 at 06:44:35PM +1300, Richard O'Keefe wrote:
As Dershowitz and Reingold showed in their book "Calendrical Calculations", converting from UTC to several calendars needs latitude, longitude, and elevation. ISO 6709 is the relevant standard: https://en.wikipedia.org/wiki/ISO_6709
My camera uses D M S (0 deg 0' 0.00", 0 deg 0' 0.00") so I'll use that initially, but I'll definitely add links in the comments and make sure that support for other formats can be added. I'm not doing any database work at the moment (storing results in STON files for now), but will also add the links to the class comments. Thanks again, Alistair
Just for the record. I have a GeoJSON (http://geojson.org/) package at https://github.com/noha/geo-json/ This tackles geo coordinates from yet another angle: How to model a geo position as POI (point of interest) and having a common format for it. And in the meantime geo json is the storage format for geo coordinates in mongo DB. There are point classes in there that can be used with degree/minute/second. But surely something different then your needs Norbert
Am 05.12.2018 um 08:34 schrieb Alistair Grant <akgrant0710@gmail.com>:
Hi Pierce & Richard,
Thanks for your replies.
On Wed, Dec 05, 2018 at 10:24:18AM +0800, Pierce Ng wrote:
On Tue, Dec 04, 2018 at 10:21:20AM +0100, Alistair Grant wrote: Does anyone know of a library for processing GPS coordinates?
What I'm looking for are things like:
- Parsing from and printing to various string formats (HMS, NESW, decimal) - Distance between two points - etc.
SQLite-based possibilities:
- Spatialite: https://www.gaia-gis.it/fossil/libspatialite/index - R*Tree: https://sqlite.org/rtree.html - GeoPoly: https://sqlite.org/geopoly.html
On Wed, Dec 05, 2018 at 06:44:35PM +1300, Richard O'Keefe wrote: As Dershowitz and Reingold showed in their book "Calendrical Calculations", converting from UTC to several calendars needs latitude, longitude, and elevation. ISO 6709 is the relevant standard: https://en.wikipedia.org/wiki/ISO_6709
My camera uses D M S (0 deg 0' 0.00", 0 deg 0' 0.00") so I'll use that initially, but I'll definitely add links in the comments and make sure that support for other formats can be added.
I'm not doing any database work at the moment (storing results in STON files for now), but will also add the links to the class comments.
Thanks again, Alistair
On Wed, Dec 05, 2018 at 07:34:35AM +0000, Alistair Grant wrote:
I'm not doing any database work at the moment (storing results in STON files for now), but will also add the links to the class comments.
Hi Alistair, I wasn't suggesting storing data in a database per se. I thought that, given that the desired functionality is not available in Pharo, the options are to implement it in pure Smalltalk or wrap an existing library. In the latter case, typically one wraps a C library using FFI. With SQLite, its extensions are C libraries that are already wrapped for SQL. Writing SQL queries may get you a long way where you're going. Pierce
Hi Pierce, On Thu, 6 Dec 2018 at 03:38, Pierce Ng <pierce@samadhiweb.com> wrote:
On Wed, Dec 05, 2018 at 07:34:35AM +0000, Alistair Grant wrote:
I'm not doing any database work at the moment (storing results in STON files for now), but will also add the links to the class comments.
Hi Alistair,
I wasn't suggesting storing data in a database per se.
I thought that, given that the desired functionality is not available in Pharo, the options are to implement it in pure Smalltalk or wrap an existing library. In the latter case, typically one wraps a C library using FFI. With SQLite, its extensions are C libraries that are already wrapped for SQL. Writing SQL queries may get you a long way where you're going.
Ah, thanks for the clarification, I hadn't thought of that. I'll probably still develop a standalone library as it will be useful for the community, but this may help. Thanks again, Alistair
Hi All, If anyone is interested, I've created the beginnings of a library for handling coordinates at: https://github.com/akgrant43/GeoSphere It only: - Parses string coordinates - Calculates the distance between coordinates - Opens a web browser in OpenStreetMap at the receiver's coordinates Examples of string formats that can be parsed: - 144.61025 @ -38.28697 - 38° 17Ⲡ13.09ⳠS, 144° 36Ⲡ36.9ⳠE - 38 deg 17' 13.09" S, 144 deg 36' 36.9" E - https://www.openstreetmap.org/#map=18/-38.28697/144.61025 The distance calculation uses haversine (assumes the earth is a sphere), which is good enough for my needs at the moment. Thanks again to Sven, Benoit, Pierce and Richard for their input. Cheers, Alistair
Hi Alistair! First off, thanks for the "thank you note" in this email & on GitHub. Would you be interested in working on a port of GeoSphere (https://cran.r-project.org/web/packages/geosphere/geosphere.pdf) to Pharo ? I'll have some spare time in the next weeks so we could work on that together. Since this package is widely known and used, it could serve as a base for a Geo package for Pharo. I have R installed with this package here so cross-checking Pharo results vs R calculations wouldn't be a problem! That also means plenty of unit tests are possible ! ;) I noticed (at least on Pharo 6.1) that you reference "WebBrowser" which is either present in P7 (and not in P6) or it indicates a dependency problem. I also noticed that you use the WGS84 reference ellipsoid as a hardcoded constant (in other works, assuming the earth radius is 6378137 meters for all calculations). Modifying the code to have reference ellipsoids objects and use the WGS84 as the default (which is what everyone uses) would be a more flexible solution. Besides, it would also allow funky stuff like being able to use the same framework to work for every known spatial body like say, the Moon or Mars or whatever! Besides, that way (using reference ellipsoid objects), older maps/coordinates/calculations could still be used just by changing the ellipsoid reference. Let me know if you're interested! P.S. I couldn't find a similar package/framework for Pharo/Squeak/WhateverSmalltalk. If I missed it, let me know guys!! I'm not a big fan of reinventing the wheel!! On 2018-12-19 02:32, Alistair Grant wrote:
Hi All,
If anyone is interested, I've created the beginnings of a library for handling coordinates at: https://github.com/akgrant43/GeoSphere
It only:
- Parses string coordinates - Calculates the distance between coordinates - Opens a web browser in OpenStreetMap at the receiver's coordinates
Examples of string formats that can be parsed:
- 144.61025 @ -38.28697 - 38° 17Ⲡ13.09ⳠS, 144° 36Ⲡ36.9ⳠE - 38 deg 17' 13.09" S, 144 deg 36' 36.9" E - https://www.openstreetmap.org/#map=18/-38.28697/144.61025
The distance calculation uses haversine (assumes the earth is a sphere), which is good enough for my needs at the moment.
Thanks again to Sven, Benoit, Pierce and Richard for their input.
Cheers, Alistair
-- ----------------- Benoît St-Jean Yahoo! Messenger: bstjean Twitter: @BenLeChialeux Pinterest: benoitstjean Instagram: Chef_Benito IRC: lamneth Blogue: endormitoire.wordpress.com "A standpoint is an intellectual horizon of radius zero". (A. Einstein)
Hi Benoît, On Sat, 22 Dec 2018 at 09:02, Benoit St-Jean <bstjean@yahoo.com> wrote:
Hi Alistair!
First off, thanks for the "thank you note" in this email & on GitHub.
Would you be interested in working on a port of GeoSphere (https://cran.r-project.org/web/packages/geosphere/geosphere.pdf) to Pharo ? I'll have some spare time in the next weeks so we could work on that together. Since this package is widely known and used, it could serve as a base for a Geo package for Pharo. I have R installed with this package here so cross-checking Pharo results vs R calculations wouldn't be a problem! That also means plenty of unit tests are possible ! ;)
I'm happy to work on this together (and with whoever else is interested). Pharo is my hobby which has to fit in with family, etc., so my time is rather sporadic.
I noticed (at least on Pharo 6.1) that you reference "WebBrowser" which is either present in P7 (and not in P6) or it indicates a dependency problem.
That's why I put "Pharo 7" in the installation section :-) I haven't tried, but I expect that loading WebBrowser in to Pharo 6 is straightfoward. With Pharo 7 about to go GA I have to admit that personally I'm not interested in putting much effort in to supporting earlier versions (other than a bit of testing, I haven't used Pharo 6 since it was released :-)).
I also noticed that you use the WGS84 reference ellipsoid as a hardcoded constant (in other works, assuming the earth radius is 6378137 meters for all calculations). Modifying the code to have reference ellipsoids objects and use the WGS84 as the default (which is what everyone uses) would be a more flexible solution.
Actually, there's #haversineDistanceTo:radius: for exactly this reason (more below).
Besides, it would also allow funky stuff like being able to use the same framework to work for every known spatial body like say, the Moon or Mars or whatever! Besides, that way (using reference ellipsoid objects), older maps/coordinates/calculations could still be used just by changing the ellipsoid reference.
At the moment the EarthRadius is a class variable. It would be better and more flexible to remove it and create separate objects for the different standards and bodies.
Let me know if you're interested!
Sure. I had planned to extend this as required, but if you've got a particular approach I'm happy to try and fit in (within the time limitation mentioned above).
P.S. I couldn't find a similar package/framework for Pharo/Squeak/WhateverSmalltalk. If I missed it, let me know guys!! I'm not a big fan of reinventing the wheel!!
Ditto. Cheers, Alistair
On 2018-12-19 02:32, Alistair Grant wrote:
Hi All,
If anyone is interested, I've created the beginnings of a library for handling coordinates at: https://github.com/akgrant43/GeoSphere
It only:
- Parses string coordinates - Calculates the distance between coordinates - Opens a web browser in OpenStreetMap at the receiver's coordinates
Examples of string formats that can be parsed:
- 144.61025 @ -38.28697 - 38° 17Ⲡ13.09ⳠS, 144° 36Ⲡ36.9ⳠE - 38 deg 17' 13.09" S, 144 deg 36' 36.9" E - https://www.openstreetmap.org/#map=18/-38.28697/144.61025
The distance calculation uses haversine (assumes the earth is a sphere), which is good enough for my needs at the moment.
Thanks again to Sven, Benoit, Pierce and Richard for their input.
Cheers, Alistair
-- ----------------- Benoît St-Jean Yahoo! Messenger: bstjean Twitter: @BenLeChialeux Pinterest: benoitstjean Instagram: Chef_Benito IRC: lamneth Blogue: endormitoire.wordpress.com "A standpoint is an intellectual horizon of radius zero". (A. Einstein)
Would it be possible to "word wrap" posts on Pharo Weekly News. It's quite frustrating (and doesn't look good at all for newcomers) when you have to scroll right 10 miles away to be able to read a full sentence/paragraph. See screenshots attached. P.S. Tried with different browsers and the problem remains present. Thx ----------------- Benoît St-Jean Yahoo! Messenger: bstjean Twitter: @BenLeChialeux Pinterest: benoitstjean Instagram: Chef_Benito IRC: lamneth Blogue: endormitoire.wordpress.com "A standpoint is an intellectual horizon of radius zero". (A. Einstein)
Hi Sven, On Tue, 4 Dec 2018 at 11:04, Sven Van Caekenberghe <sven@stfx.eu> wrote:
Hi Alistair,
On 4 Dec 2018, at 10:21, Alistair Grant <akgrant0710@gmail.com> wrote:
Hi,
Does anyone know of a library for processing GPS coordinates?
What I'm looking for are things like:
- Parsing from and printing to various string formats (HMS, NESW, decimal) - Distance between two points - etc.
Thanks, Alistair
We've got some elementary stuff based on WGS84 coordinates as points. For example,
T3GeoTools distanceBetween: 5.33732@50.926 and: 5.49705@50.82733. T3GeoTools bearingFrom: 5.33732@50.926 to: 5.49705@50.82733. T3GeoTools destinationFrom: 5.33732@50.926 bearing: 45 distance: 2500. T3GeoTools centroidOf: { 5.48230@50.82249. 5.49523@50.81288. 5.50138@50.82008. 5.50228@50.82595. 5.49265@50.82560. 5.48230@50.82249 }. T3GeoTools is: 5.33732@50.92601 inside: { 5.48230@50.82249. 5.49523@50.81288. 5.50138@50.82008. 5.50228@50.82595. 5.49265@50.82560. 5.48230@50.82249 }.
This is not open source, but it is not rocket science either (just implementations of public algorithms).
Right, I'll probably have a go at this a put it up on github. It looks like you've chosen to model the coordinates using the Point class rather than creating a Coordinate class. Can you explain why (I don't have a strong preference either way, so am wondering what your thinking is). It also looks like it is longitude @ latitude. Is that correct? (I guess it lines up with the point y value being vertical, which is latitude. But most written forms put latitude first). Thanks! Alistair
Perhaps porting the R package GeoSphere to Pharo/Squeak/Smalltalk would be an option? It's rather complete and used a lot (at least in the R community) ! https://cran.r-project.org/web/packages/geosphere/geosphere.pdf ----------------- Benoît St-Jean Yahoo! Messenger: bstjean Twitter: @BenLeChialeux Pinterest: benoitstjean Instagram: Chef_Benito IRC: lamneth Blogue: endormitoire.wordpress.com "A standpoint is an intellectual horizon of radius zero". (A. Einstein) On Wednesday, December 5, 2018, 2:24:07 a.m. EST, Alistair Grant <akgrant0710@gmail.com> wrote: Hi Sven, On Tue, 4 Dec 2018 at 11:04, Sven Van Caekenberghe <sven@stfx.eu> wrote:
Hi Alistair,
On 4 Dec 2018, at 10:21, Alistair Grant <akgrant0710@gmail.com> wrote:
Hi,
Does anyone know of a library for processing GPS coordinates?
What I'm looking for are things like:
- Parsing from and printing to various string formats (HMS, NESW, decimal) - Distance between two points - etc.
Thanks, Alistair
We've got some elementary stuff based on WGS84 coordinates as points. For example,
T3GeoTools distanceBetween: 5.33732@50.926 and: 5.49705@50.82733. T3GeoTools bearingFrom: 5.33732@50.926 to: 5.49705@50.82733. T3GeoTools destinationFrom: 5.33732@50.926 bearing: 45 distance: 2500. T3GeoTools centroidOf: { 5.48230@50.82249. 5.49523@50.81288. 5.50138@50.82008. 5.50228@50.82595. 5.49265@50.82560. 5.48230@50.82249 }. T3GeoTools is: 5.33732@50.92601 inside: { 5.48230@50.82249. 5.49523@50.81288. 5.50138@50.82008. 5.50228@50.82595. 5.49265@50.82560. 5.48230@50.82249 }.
This is not open source, but it is not rocket science either (just implementations of public algorithms).
Right, I'll probably have a go at this a put it up on github. It looks like you've chosen to model the coordinates using the Point class rather than creating a Coordinate class. Can you explain why (I don't have a strong preference either way, so am wondering what your thinking is). It also looks like it is longitude @ latitude. Is that correct? (I guess it lines up with the point y value being vertical, which is latitude. But most written forms put latitude first). Thanks! Alistair
On 5 Dec 2018, at 08:23, Alistair Grant <akgrant0710@gmail.com> wrote:
Hi Sven,
On Tue, 4 Dec 2018 at 11:04, Sven Van Caekenberghe <sven@stfx.eu> wrote:
Hi Alistair,
On 4 Dec 2018, at 10:21, Alistair Grant <akgrant0710@gmail.com> wrote:
Hi,
Does anyone know of a library for processing GPS coordinates?
What I'm looking for are things like:
- Parsing from and printing to various string formats (HMS, NESW, decimal) - Distance between two points - etc.
Thanks, Alistair
We've got some elementary stuff based on WGS84 coordinates as points. For example,
T3GeoTools distanceBetween: 5.33732@50.926 and: 5.49705@50.82733. T3GeoTools bearingFrom: 5.33732@50.926 to: 5.49705@50.82733. T3GeoTools destinationFrom: 5.33732@50.926 bearing: 45 distance: 2500. T3GeoTools centroidOf: { 5.48230@50.82249. 5.49523@50.81288. 5.50138@50.82008. 5.50228@50.82595. 5.49265@50.82560. 5.48230@50.82249 }. T3GeoTools is: 5.33732@50.92601 inside: { 5.48230@50.82249. 5.49523@50.81288. 5.50138@50.82008. 5.50228@50.82595. 5.49265@50.82560. 5.48230@50.82249 }.
This is not open source, but it is not rocket science either (just implementations of public algorithms).
Right, I'll probably have a go at this a put it up on github.
It looks like you've chosen to model the coordinates using the Point class rather than creating a Coordinate class. Can you explain why (I don't have a strong preference either way, so am wondering what your thinking is).
It also looks like it is longitude @ latitude. Is that correct? (I guess it lines up with the point y value being vertical, which is latitude. But most written forms put latitude first).
I used the simplest thing that could work, using the mathematically oriented x@y (long@lat) form. From what I am doing, it works just fine. Converting to/from HMS notation is not hard I. Here is an example: distanceBetween: firstPosition and: secondPosition "T3GeoTools distanceBetween: 5.33732@50.926 and: 5.49705@50.82733" | c | c := (firstPosition y degreeSin * secondPosition y degreeSin) + (firstPosition y degreeCos * secondPosition y degreeCos * (secondPosition x degreesToRadians - firstPosition x degreesToRadians) cos). c := c >= 0 ifTrue: [ 1 min: c ] ifFalse: [ -1 max: c ]. ^ c arcCos * 6371000 I would not have anything against a real object, as long as it is mathematically sound and used properly. I think that only WGS84 makes sense as internal representation though - it seems the most common thing anyway.
Thanks! Alistair
Alistair, I found this page really useful http://www.movable-type.co.uk/scripts/latlong.html HTH, Sven
On 5 Dec 2018, at 11:48, Sven Van Caekenberghe <sven@stfx.eu> wrote:
On 5 Dec 2018, at 08:23, Alistair Grant <akgrant0710@gmail.com> wrote:
Hi Sven,
On Tue, 4 Dec 2018 at 11:04, Sven Van Caekenberghe <sven@stfx.eu> wrote:
Hi Alistair,
On 4 Dec 2018, at 10:21, Alistair Grant <akgrant0710@gmail.com> wrote:
Hi,
Does anyone know of a library for processing GPS coordinates?
What I'm looking for are things like:
- Parsing from and printing to various string formats (HMS, NESW, decimal) - Distance between two points - etc.
Thanks, Alistair
We've got some elementary stuff based on WGS84 coordinates as points. For example,
T3GeoTools distanceBetween: 5.33732@50.926 and: 5.49705@50.82733. T3GeoTools bearingFrom: 5.33732@50.926 to: 5.49705@50.82733. T3GeoTools destinationFrom: 5.33732@50.926 bearing: 45 distance: 2500. T3GeoTools centroidOf: { 5.48230@50.82249. 5.49523@50.81288. 5.50138@50.82008. 5.50228@50.82595. 5.49265@50.82560. 5.48230@50.82249 }. T3GeoTools is: 5.33732@50.92601 inside: { 5.48230@50.82249. 5.49523@50.81288. 5.50138@50.82008. 5.50228@50.82595. 5.49265@50.82560. 5.48230@50.82249 }.
This is not open source, but it is not rocket science either (just implementations of public algorithms).
Right, I'll probably have a go at this a put it up on github.
It looks like you've chosen to model the coordinates using the Point class rather than creating a Coordinate class. Can you explain why (I don't have a strong preference either way, so am wondering what your thinking is).
It also looks like it is longitude @ latitude. Is that correct? (I guess it lines up with the point y value being vertical, which is latitude. But most written forms put latitude first).
I used the simplest thing that could work, using the mathematically oriented x@y (long@lat) form. From what I am doing, it works just fine. Converting to/from HMS notation is not hard I.
Here is an example:
distanceBetween: firstPosition and: secondPosition "T3GeoTools distanceBetween: 5.33732@50.926 and: 5.49705@50.82733"
| c | c := (firstPosition y degreeSin * secondPosition y degreeSin) + (firstPosition y degreeCos * secondPosition y degreeCos * (secondPosition x degreesToRadians - firstPosition x degreesToRadians) cos). c := c >= 0 ifTrue: [ 1 min: c ] ifFalse: [ -1 max: c ]. ^ c arcCos * 6371000
I would not have anything against a real object, as long as it is mathematically sound and used properly. I think that only WGS84 makes sense as internal representation though - it seems the most common thing anyway.
Thanks! Alistair
Hi Sven, On Wed, 5 Dec 2018 at 16:08, Sven Van Caekenberghe <sven@stfx.eu> wrote:
Alistair,
I found this page really useful http://www.movable-type.co.uk/scripts/latlong.html
Thanks! That will definitely save me some time. And I used to own a TRS-80 clone. :-) Cheers, Alistair
I have long wanted to do a FFI interface to GDAL. I think Pharo would make a great GIS workbench. Possibly when 64bit UFFI stabilizes.
On Dec 4, 2018, at 1:21 AM, Alistair Grant <akgrant0710@gmail.com> wrote:
Hi,
Does anyone know of a library for processing GPS coordinates?
What I'm looking for are things like:
- Parsing from and printing to various string formats (HMS, NESW, decimal) - Distance between two points - etc.
Thanks, Alistair
On Tue, Dec 04, 2018 at 10:21:20AM +0100, Alistair Grant wrote:
Does anyone know of a library for processing GPS coordinates?
What I'm looking for are things like:
- Parsing from and printing to various string formats (HMS, NESW, decimal) - Distance between two points - etc.
SQLite-based possibilities: - Spatialite: https://www.gaia-gis.it/fossil/libspatialite/index - R*Tree: https://sqlite.org/rtree.html - GeoPoly: https://sqlite.org/geopoly.html
participants (8)
-
Alistair Grant -
Benoit St-Jean -
Cédrick Béler -
Norbert Hartl -
Pierce Ng -
Richard O'Keefe -
Sven Van Caekenberghe -
Todd Blanchard