GPSBabel / gpsbabel

GPSBabel: convert, manipulate, and transfer data from GPS programs or GPS receivers. Open Source and supported on MacOS, Windows, Linux, and more. Pointy clicky GUI or a command line version...
https://www.gpsbabel.org
GNU General Public License v2.0
465 stars 125 forks source link

Google Map KLM convertion to GPX - GPX size #1292

Open Mint-me123 opened 1 month ago

Mint-me123 commented 1 month ago

Is it possible to optimize the conversion from a google map KML to a GPX so the GPX stays small. Converting a 500-700 kb KML gives a 2.8 MB GPX. It is for use with a mobile app on a bike so only tracks or routes are needed nothing else. Possible. Perhaps not if google KMLs are just full of "stuff". Downloaded GPX made for bike trips are normally around 200-600 kb so that is why I thought it might be possible.

tsteven4 commented 1 month ago

It may be possible, it depends on what is in your kml that you don't want. You can use the nuketypes filter to get rid of waypoints and/or routes and/or tracks. If you have duplicate track or route data it may be possible to delete it with the track filter. You can reduce the number of points in a route or track with the simplify filter. I often use that to reduce the number of points recorded by a Garmin Edge to something Google Earth is happier with.

Mint-me123 commented 1 month ago

Hi thank you for your suggestions. I tried the nukes... Filter. Only removing tracks and routes gave me a smaller size but for some reason it showed a different "route". Keeping tracks only or routes only gave a functional "route" but didn't reduce size. I will try to use simplify as well. Perhaps a look inside with a text editor will show me the surplus kb. Thank you again

Mint-me123 commented 1 month ago

Update. Simplify worked a treat. GPS Studio showed that the org kml from Gmaps had 28000 point. Reducing that to 10k, 5k, 2k and finally 1k brought the gpx down to 92 kb and fully functional. Is there a way to see how many points a route has when you elect to simplify like GPS Studio has. Would be a good feature. Thank you for the help. Now I just need to make sure the gpx tracks shows up as a real name and not as track1 2 3 etc... in a text editor i guess.

robertlipe commented 1 month ago

Good.

No, we don't really expose ways for you to edit your own data. We convert and leaving editing and mapping and such to editors and maps.

RJL

On Fri, Jul 12, 2024 at 11:15 AM Mint-me123 @.***> wrote:

Update. Simplify worked a treat. GPS Studio showed that the org kml from Gmaps had 28000 point. Reducing that to 10k, 5k, 2k and finally 1k brought the gpx down to 92 kb and fully functional. Is there a way to see how many points a route has when you elect to simplify like GPS Studio has. Would be a good feature. Thank you for the help. Now I just need to make sure the gpx tracks shows up as a real name and not as track1 2 3 etc... in a text editor i guess.

— Reply to this email directly, view it on GitHub https://github.com/GPSBabel/gpsbabel/issues/1292#issuecomment-2225907652, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACCSD3667TBLELI2JHTQQRLZL76JLAVCNFSM6AAAAABKVYLPL2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRVHEYDONRVGI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

tsteven4 commented 1 month ago

You can see the number waypoints, routes and tracks by using the validate filter. I often use it twice in one invocation, once before the simplify filter and once after.

Here is an example. The fit file contained 1 waypoint and 1 track with 22940 points. After simplify with an allowed error of 2 meters the track was reduced to 1170 points.

$ gpsbabel -i garmin_fit -f 15530281629_ACTIVITY.fit -x validate,debug -x simplify,error=2m -x validate,debug -o gpx -F x.g
px

Processing waypts
point ct: 1, waypt_count: 1

Processing routes
route head ct: 0, route_count: 0
total route point ct: 0, route_waypt_count: 0

Processing tracks
track 0 ct: 22940, waypt_count: 22940
track head ct: 1, track_count: 1
total track point ct: 22940, track_waypt_count: 22940

Processing waypts
point ct: 1, waypt_count: 1

Processing routes
route head ct: 0, route_count: 0
total route point ct: 0, route_waypt_count: 0

Processing tracks
track 0 ct: 1170, waypt_count: 1170
track head ct: 1, track_count: 1
total track point ct: 1170, track_waypt_count: 1170
tsteven4 commented 1 month ago

If your intent is to create a route to follow from a track you may wish to also use the transform filter. The del option deletes the original track after transforming it to a route, the timeless option deletes the track point timestamps. In this case the transform filter reduced the gpx size an additional 32%.

$ gpsbabel -i garmin_fit -f 15530281629_ACTIVITY.fit -x validate,debug -x simplify,error=2m -x transform,rte=trk,del,timeless -x validate,debug -o gpx -F x.gpx && wc x.gpx

Processing waypts
point ct: 1, waypt_count: 1

Processing routes
route head ct: 0, route_count: 0
total route point ct: 0, route_waypt_count: 0

Processing tracks
track 0 ct: 22940, waypt_count: 22940
track head ct: 1, track_count: 1
total track point ct: 22940, track_waypt_count: 22940

Processing waypts
point ct: 1, waypt_count: 1

Processing routes
route 0 ct: 1170, waypt_count: 1170
route head ct: 1, route_count: 1
total route point ct: 1170, route_waypt_count: 1170

Processing tracks
track head ct: 0, track_count: 0
total track point ct: 0, track_waypt_count: 0
  4692   7045 137503 x.gpx