GPSFileDepot.com
 

News:

Welcome to GPSFileDepot!

Main Menu

Free MP to IMG converter with routing support??

Started by dhisum_dhisum, February 06, 2009, 05:13:43 PM

Previous topic - Next topic

dhisum_dhisum

I started thinking that since cGPSMapper charges your first born child for the routing version, could we not write a MP to img converter ourselves. I started looking here and there and found a few resources. This page http://wiki.openstreetmap.org/index.php/OSM_Map_On_Garmin/Format lists them all.

I looked yesterday at the MP file format. It is basically a text file with pretty simple format. Sitting for a few hours, I was able to code up something that could load up the MP format files in memory. Now comes the difficult part. The Garmin IMG format is somewhat a mystery and in spite of some people having dug through it, the autorouting/searching part of it seems like a mystery still. Anyone else have any experience in this?

krellor

I have looked at a pdf the goes through what is known of the IMG format.  http://sourceforge.net/projects/garmin-img/

I'll admit, I'm a professional programmer, and writing a comprehensive IMG handler looks daunting.  It could take weeks, but more likely months of work and testing.  The inside of the IMG files are basically little file systems.  I had thought the same thing about making my own converter, but looking at the file specification, it looks like a whole bunch of work.  I guess my problem is that I don't really need routing so for myself, it isn't worth months of hard coding.  That said, if there was enough community support to get it done, I would contribute my skills to an open source project.

Also, the best documented file specification is from 2001, so who knows what has been changed that only those like Stan (cGPSMaker creator) knows about.  That is another few months of uploading maps to GPS units, figuring out what isn't right, and going back to source.  I just don't have the time to do it by myself, and I don't know how many programmers we have here who all know the same languages.  If people want to list the languages they know I guess I'll start and see if there is any overlap.

C
C++
C#
x86 Assembler
VB.net
Cobol
Rexx
Natural

And a few other scripting languages.

-Oz-

I'm looking for something that takes the shapefiles and makes them into .mp easily :)

But this would be awesome
Dan Blomberg
Administrator - GPSFileDepot
GPS Units: Garmin Dakota 20, Garmin GPSMap 60csx, Nuvi 255W, Nuvi 250W, ForeRunner 110, Fenix 2, Tactix Bravo, Foretrex 401
See/Download My Maps!

dhisum_dhisum

I looked at the sourceforge document as well. It does look daunting but there are some open source implementations. Maybe we can use them as reference of build on top of that. I write software for a living too and I am good with C/C++, C# and have used  Java, python, perl etc. a while back I taught assembly long back, and it is still not all lost from my head.

Oz,

Why would shapefile to MP be useful? The shapefile format seems to be well documented:
www.esri.com/library/whitepapers/pdfs/shapefile.pdf

There seems to be a C library to deal with shapelib here:
http://shapelib.maptools.org/

-Oz-

Because then I could try to automate the entire process and not have to wait for it to open in global mapper or the like to get it back out to .mp files.
Dan Blomberg
Administrator - GPSFileDepot
GPS Units: Garmin Dakota 20, Garmin GPSMap 60csx, Nuvi 255W, Nuvi 250W, ForeRunner 110, Fenix 2, Tactix Bravo, Foretrex 401
See/Download My Maps!

John_M

Oz

The shareware version of cgpsmapper is only 30$ and has support for shapefiles. Having cgpsmapper read the shapefile is how my workflow runs.

krellor

dhisum_dhisum, if you are interested in trying to write something like this then I'll help.  I think we would probably want to write it in C.  What are your thoughts on it?

-Oz-

Quote from: John_M on February 07, 2009, 04:42:46 PM
Oz

The shareware version of cgpsmapper is only 30$ and has support for shapefiles. Having cgpsmapper read the shapefile is how my workflow runs.


Does it read the MP_TYPE column from it or?

And I don't know C (know php/sql/vb) but for a project like this I'd probably learn.
Dan Blomberg
Administrator - GPSFileDepot
GPS Units: Garmin Dakota 20, Garmin GPSMap 60csx, Nuvi 255W, Nuvi 250W, ForeRunner 110, Fenix 2, Tactix Bravo, Foretrex 401
See/Download My Maps!

John_M

Quote from: -Oz- on February 07, 2009, 05:43:08 PM

Does it read the MP_TYPE column from it or?

And I don't know C (know php/sql/vb) but for a project like this I'd probably learn.


This is part of the mp file I use that reads in a shapefile. You tell it what column to use

[SHP]
name=nhd_waterbody401221
Type=RGN80
LabelField=name
TypeField=mp_type
Level=0
EndLevel=3
[END]

-Oz-

Dan Blomberg
Administrator - GPSFileDepot
GPS Units: Garmin Dakota 20, Garmin GPSMap 60csx, Nuvi 255W, Nuvi 250W, ForeRunner 110, Fenix 2, Tactix Bravo, Foretrex 401
See/Download My Maps!

dhisum_dhisum

Krellor, i have been thinking on this. I think C is a good language to code this in. However, C# would probably be a lot faster as it has support for a lot of data structures directly built in. For performance critical sections, we could always write the performance critical sections  using COM and COM interop. I started reading the garmin-img doc and doing a little hex reading of the IMGs that I have. It would probably make sense to read one of the city navigator IMGs to understand how the routing thing works.

What do you think?

Regarding Oz's thoughts on Shapefile to MP conversion, Someone already wrote a .NET wrapper on type of the shapelib. Maybe one of these days, I will just use that to write the v0.1 version for converting shapefile to MPs

-Oz-

Yea, I'd say definitely start with just .mp to .img; then add searching for POIs and stuff; then do routable; I'd sell the routable version (but for maybe $100 or something small).
Dan Blomberg
Administrator - GPSFileDepot
GPS Units: Garmin Dakota 20, Garmin GPSMap 60csx, Nuvi 255W, Nuvi 250W, ForeRunner 110, Fenix 2, Tactix Bravo, Foretrex 401
See/Download My Maps!

maps4gps

#12
This may not be a big concern if you use the Census Tiger data for roads.  They appear to divide ever line by any/ever other line that intersects.

krellor

Well, in my mind routing is way down the road.  The first step will be to better understand the IMG format, and start work on a mp to img converter. 

dhisum_dhisum, C# would work fine for me.  I am a big fan of C#.  My main concern is indeed the memory management aspect of it.  Your solution for that seems fine to me.  We could even maybe get around doing that by creating our own swap files in C# if the problem is simply storing a large amount of data in memory.  I admit that I do find it frustrating that many of these programs try to operate entirely in volatile memory.  I know that performance can take a hit using swap file, but at least the job gets done on machines with less RAM.  Maybe it could be option at run time to use a swap file or not.

For now, I am still reading up on the IMG format specifications.