Artifacts in final map (.MP -> .IMG conversion)

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

Artifacts in final map (.MP -> .IMG conversion)

Vadim
Hi!

As a result of conversion *.MP* to *.IMG* with *Mkgmap* (java -jar
mkgmap.jar --mapname=12345678 --family-id=1281 --product-id=1
"AmericanLake.mp"), clearly expressed artifacts appear in the resulting map:

<https://b.radikal.ru/b07/1902/89/31a7f4de23d0.png>

If convert the same .MP-file using *cGPSmapper.exe*, such artifacts do not
appear:

<https://b.radikal.ru/b25/1902/62/de23809b837d.png>

I suspect the reason is rather in the source .MP file:
* Multipolygons consist of several hundred points.
* The GPSMapEdit program finds intersections and overlays of polygons:
http://b.radikal.ru/b29/1902/34/8177994b7e98.png
* In addition, after converting multipolygons to polygons (deleting internal
polygons from the file used), the artifacts disappear. But it is impossible
to use a map (some objects such as islands and hills disappear) obtained in
this way:

<https://a.radikal.ru/a42/1902/94/0b9aeffc449e.png>

However, despite possible problems with the source file, *cGPSmapper.exe
converts it without any problems* !!!

Is there a way to get *Mkgmap* to convert this file ?
Maybe there are some "secret" command line parameters ?
I tried unsuccessfully these arguments:
--reduce-point-density=
--reduce-point-density-polygon=
--order-by-decreasing-area
...

Generalization in GpsMapEdit not helped...

Original *.MP* file posted here: https://yadi.sk/d/c5-7lv8v-Ubvzw

Thanks for any advice and suggestions!



--
Sent from: http://gis.19327.n8.nabble.com/Mkgmap-Development-f5324443.html
_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Reply | Threaded
Open this post in threaded view
|

Re: Artifacts in final map (.MP -> .IMG conversion)

Gerd Petermann
Hi Vadim,

I don't know much about the mp format, but If I got that right mkgmap cannot handle holes in polygons, it simply combines the points
and that results in these artifacts.

Gerd

________________________________________
Von: mkgmap-dev <[hidden email]> im Auftrag von Vadim <[hidden email]>
Gesendet: Freitag, 8. Februar 2019 13:12
An: [hidden email]
Betreff: [mkgmap-dev] Artifacts in final map (.MP -> .IMG conversion)

Hi!

As a result of conversion *.MP* to *.IMG* with *Mkgmap* (java -jar
mkgmap.jar --mapname=12345678 --family-id=1281 --product-id=1
"AmericanLake.mp"), clearly expressed artifacts appear in the resulting map:

<https://b.radikal.ru/b07/1902/89/31a7f4de23d0.png>

If convert the same .MP-file using *cGPSmapper.exe*, such artifacts do not
appear:

<https://b.radikal.ru/b25/1902/62/de23809b837d.png>

I suspect the reason is rather in the source .MP file:
* Multipolygons consist of several hundred points.
* The GPSMapEdit program finds intersections and overlays of polygons:
http://b.radikal.ru/b29/1902/34/8177994b7e98.png
* In addition, after converting multipolygons to polygons (deleting internal
polygons from the file used), the artifacts disappear. But it is impossible
to use a map (some objects such as islands and hills disappear) obtained in
this way:

<https://a.radikal.ru/a42/1902/94/0b9aeffc449e.png>

However, despite possible problems with the source file, *cGPSmapper.exe
converts it without any problems* !!!

Is there a way to get *Mkgmap* to convert this file ?
Maybe there are some "secret" command line parameters ?
I tried unsuccessfully these arguments:
--reduce-point-density=
--reduce-point-density-polygon=
--order-by-decreasing-area
...

Generalization in GpsMapEdit not helped...

Original *.MP* file posted here: https://yadi.sk/d/c5-7lv8v-Ubvzw

Thanks for any advice and suggestions!



--
Sent from: http://gis.19327.n8.nabble.com/Mkgmap-Development-f5324443.html
_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Reply | Threaded
Open this post in threaded view
|

Re: Artifacts in final map (.MP -> .IMG conversion)

Vadim
Thank you very much for your answer!

Unfortunately, you are right.
Tested Mkgmap with .MP file containing only one multipolygon.
Even with a single hole (inner ring) in the polygon artifacts appear.
Tried converters: mp2osm and pfm2osm, but without success.

In the .MP format in a polygon declaration, the first line, starting with
DATA, is interpreted as an external polygon. Subsequent lines with DATA - as
internal polygons (holes).
Example:
===============
[POLYGON]
Type=0x10F00
Label=0m
Data0=(47.10833863,-122.58886798),(47.1085766,-122.58880805)... -- OUTER
RING
Data0=(47.112746813,-122.575967689),(47.112912753,-122.576180323)... --INNER
RING
Data0=(47.12197852,-122.57097549),(47.12206612,-122.57104106)... --INNER
RING
Data0=(47.12129872,-122.570572),(47.12133023,-122.57074099)... --INNER RING
Data0=(47.11818971,-122.57436289),(47.1182273,-122.574508)... --INNER RING
[END]
===============

I looked at the source (PolishMapDataSource.java) and saw the following:
------
if (name.startsWith("Data")) {
                        List<Coord> newPoints = coordsFromString(value);

                        if(points != null)
                                points.addAll(newPoints); //!!!!!!!!//
                        else
                                points = newPoints;
                        setResolution(shape, name);
------
I am not JAVA-programmer, but I suspect that the error is in the line
*points.addAll(newPoints)* -- Mkgmap simply sums the coordinates from
different DATA lines !!!

To be sure, I made an experiment.
Created 2 .MP files.
In the first one I described 1 multipolygon (one external polygon and four
internal).
In the second one define 1 polygon created by summing the coordinates of the
polygons from the first .MP file.
Converted both files using Mkgmap and compared the resulting .IMG files.
They matched!
Test files: https://yadi.sk/d/EuCVJEiucFoKQg





--
Sent from: http://gis.19327.n8.nabble.com/Mkgmap-Development-f5324443.html
_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Reply | Threaded
Open this post in threaded view
|

Re: Artifacts in final map (.MP -> .IMG conversion)

Gerd Petermann
Hi Vadim,

if you are sure that all further lines starting with DATA0  are inner rings, it would be rather easy to implement support for that. It would be a lot more effort if this format also supports multiple outer rings like in OSM(1), or if multiple lines build one ring and so on.
(1) like type=multipolygon relations in OSM

Gerd

________________________________________
Von: mkgmap-dev <[hidden email]> im Auftrag von Vadim <[hidden email]>
Gesendet: Freitag, 8. Februar 2019 18:13
An: [hidden email]
Betreff: Re: [mkgmap-dev] Artifacts in final map (.MP -> .IMG conversion)

Thank you very much for your answer!

Unfortunately, you are right.
Tested Mkgmap with .MP file containing only one multipolygon.
Even with a single hole (inner ring) in the polygon artifacts appear.
Tried converters: mp2osm and pfm2osm, but without success.

In the .MP format in a polygon declaration, the first line, starting with
DATA, is interpreted as an external polygon. Subsequent lines with DATA - as
internal polygons (holes).
Example:
===============
[POLYGON]
Type=0x10F00
Label=0m
Data0=(47.10833863,-122.58886798),(47.1085766,-122.58880805)... -- OUTER
RING
Data0=(47.112746813,-122.575967689),(47.112912753,-122.576180323)... --INNER
RING
Data0=(47.12197852,-122.57097549),(47.12206612,-122.57104106)... --INNER
RING
Data0=(47.12129872,-122.570572),(47.12133023,-122.57074099)... --INNER RING
Data0=(47.11818971,-122.57436289),(47.1182273,-122.574508)... --INNER RING
[END]
===============

I looked at the source (PolishMapDataSource.java) and saw the following:
------
if (name.startsWith("Data")) {
                        List<Coord> newPoints = coordsFromString(value);

                        if(points != null)
                                points.addAll(newPoints); //!!!!!!!!//
                        else
                                points = newPoints;
                        setResolution(shape, name);
------
I am not JAVA-programmer, but I suspect that the error is in the line
*points.addAll(newPoints)* -- Mkgmap simply sums the coordinates from
different DATA lines !!!

To be sure, I made an experiment.
Created 2 .MP files.
In the first one I described 1 multipolygon (one external polygon and four
internal).
In the second one define 1 polygon created by summing the coordinates of the
polygons from the first .MP file.
Converted both files using Mkgmap and compared the resulting .IMG files.
They matched!
Test files: https://yadi.sk/d/EuCVJEiucFoKQg





--
Sent from: http://gis.19327.n8.nabble.com/Mkgmap-Development-f5324443.html
_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Reply | Threaded
Open this post in threaded view
|

Re: Artifacts in final map (.MP -> .IMG conversion)

Vadim
An .MP file can contain several [POLYGON] or [RGN80] sections.
Each [POLYGON] or [RGN80] section contains ONLY ONE outer ring and MAY
contain 1 or more inner rings (holes).
In this sections each line starting with DATA# defines ONLY ONE polygon:
The first line of DATA# defines OUTER ring.
The following DATA# line(s) (if any) define INNER ring(s).

See Page 23 (Section 4.2.4.2) and Page 98 (Section 10.6) of the cGPSmapper
User Manual:

https://web.archive.org/web/20140718154101if_/http://www.cgpsmapper.com/download/cGPSmapper-UsrMan-v02.5.pdf#page=98



--
Sent from: http://gis.19327.n8.nabble.com/Mkgmap-Development-f5324443.html
_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Reply | Threaded
Open this post in threaded view
|

Re: Artifacts in final map (.MP -> .IMG conversion)

Gerd Petermann
Hi Vadim,

OK, thanks for the hints. I should have found that on my own ;)
It would be a good help if you could also post a link to the img file produced by cGPSmapper for your example file.

Gerd

________________________________________
Von: mkgmap-dev <[hidden email]> im Auftrag von Vadim <[hidden email]>
Gesendet: Freitag, 8. Februar 2019 20:33
An: [hidden email]
Betreff: Re: [mkgmap-dev] Artifacts in final map (.MP -> .IMG conversion)

An .MP file can contain several [POLYGON] or [RGN80] sections.
Each [POLYGON] or [RGN80] section contains ONLY ONE outer ring and MAY
contain 1 or more inner rings (holes).
In this sections each line starting with DATA# defines ONLY ONE polygon:
The first line of DATA# defines OUTER ring.
The following DATA# line(s) (if any) define INNER ring(s).

See Page 23 (Section 4.2.4.2) and Page 98 (Section 10.6) of the cGPSmapper
User Manual:

https://web.archive.org/web/20140718154101if_/http://www.cgpsmapper.com/download/cGPSmapper-UsrMan-v02.5.pdf#page=98



--
Sent from: http://gis.19327.n8.nabble.com/Mkgmap-Development-f5324443.html
_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Reply | Threaded
Open this post in threaded view
|

Re: Artifacts in final map (.MP -> .IMG conversion)

Vadim
Full test package (with cGPSmapper): https://yadi.sk/d/pYE_99SYI8-pIw




--
Sent from: http://gis.19327.n8.nabble.com/Mkgmap-Development-f5324443.html
_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Reply | Threaded
Open this post in threaded view
|

Re: Artifacts in final map (.MP -> .IMG conversion)

popej
In reply to this post by Gerd Petermann
Hi Gerd,

I think I have written about these problems some time ago. There is
similar problem for polylines, which contains multiple DATA statement.
Each DATA is a separate line in mp format, but mkgmap connects them
together, which is wrong:
SEVERE (PolishMapDataSource): 29483016.mp: Line null has multiple Data
lines - concatenating the points

See attached picture with source mp and compiled img in GPSMapEdit.

--
Best regards,
Andrzej

_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

mdata.png (27K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Artifacts in final map (.MP -> .IMG conversion)

Gerd Petermann
Hi,

please try r4269. I think there is one more problem to solve when data contains data lines for different levels like this
example from the manual:
[RGN40]
Type=22
Label=
EndLevel=2
Data0=(51.562624,-1.070283),(51.561637,-1.070592),(51.561272,-1.069878), (51.560059,-1.064277)
Data1=(51.562624,-1.070283),(51.561272,-1.069878),(51.560059,-1.064277)
[END]

Working on it now..
Gerd

________________________________________
Von: mkgmap-dev <[hidden email]> im Auftrag von Andrzej Popowski <[hidden email]>
Gesendet: Freitag, 8. Februar 2019 23:07
An: [hidden email]
Betreff: Re: [mkgmap-dev] Artifacts in final map (.MP -> .IMG conversion)

Hi Gerd,

I think I have written about these problems some time ago. There is
similar problem for polylines, which contains multiple DATA statement.
Each DATA is a separate line in mp format, but mkgmap connects them
together, which is wrong:
SEVERE (PolishMapDataSource): 29483016.mp: Line null has multiple Data
lines - concatenating the points

See attached picture with source mp and compiled img in GPSMapEdit.

--
Best regards,
Andrzej
_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Reply | Threaded
Open this post in threaded view
|

Re: Artifacts in final map (.MP -> .IMG conversion)

Gerd Petermann
OK, I hope with r4270 most mp files should work now.

@Vadim: Can I use your sample file as input for a unit test?

Gerd

________________________________________
Von: mkgmap-dev <[hidden email]> im Auftrag von Gerd Petermann <[hidden email]>
Gesendet: Samstag, 9. Februar 2019 08:51
An: Andrzej Popowski; Development list for mkgmap
Betreff: Re: [mkgmap-dev] Artifacts in final map (.MP -> .IMG conversion)

Hi,

please try r4269. I think there is one more problem to solve when data contains data lines for different levels like this
example from the manual:
[RGN40]
Type=22
Label=
EndLevel=2
Data0=(51.562624,-1.070283),(51.561637,-1.070592),(51.561272,-1.069878), (51.560059,-1.064277)
Data1=(51.562624,-1.070283),(51.561272,-1.069878),(51.560059,-1.064277)
[END]

Working on it now..
Gerd

________________________________________
Von: mkgmap-dev <[hidden email]> im Auftrag von Andrzej Popowski <[hidden email]>
Gesendet: Freitag, 8. Februar 2019 23:07
An: [hidden email]
Betreff: Re: [mkgmap-dev] Artifacts in final map (.MP -> .IMG conversion)

Hi Gerd,

I think I have written about these problems some time ago. There is
similar problem for polylines, which contains multiple DATA statement.
Each DATA is a separate line in mp format, but mkgmap connects them
together, which is wrong:
SEVERE (PolishMapDataSource): 29483016.mp: Line null has multiple Data
lines - concatenating the points

See attached picture with source mp and compiled img in GPSMapEdit.

--
Best regards,
Andrzej
_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Reply | Threaded
Open this post in threaded view
|

Re: Artifacts in final map (.MP -> .IMG conversion)

Vadim
In reply to this post by Gerd Petermann
Hi Gerd!

Great job!
I checked several .MP files - everything works properly.

By the way, an interesting comparison of cGPSmapper and Mkgmap output files:
Example1:
cGPSmapper
http://a.radikal.ru/a43/1902/62/573d37c22161.png
Mkgmap
http://c.radikal.ru/c30/1902/7e/5e51e8915bb6.png

Example2:
cGPSmapper
http://b.radikal.ru/b11/1902/44/25150c628d84.png
Mkgmap
http://d.radikal.ru/d27/1902/45/f73efd557e06.png

As you can see, there are practically no gaps between polygons in files
created with Mkgmap.

That's why I became interested in using your program.
Thank you so much!



--
Sent from: http://gis.19327.n8.nabble.com/Mkgmap-Development-f5324443.html
_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Reply | Threaded
Open this post in threaded view
|

Re: Artifacts in final map (.MP -> .IMG conversion)

Gerd Petermann
Hi Vadim,

thanks for the quick and nice feedback. You may try these options to reduce the gaps:
--min-size-polygon=0
--reduce-point-density=0

By the way: What program do you use to create these *.mp files?

Gerd

________________________________________
Von: mkgmap-dev <[hidden email]> im Auftrag von Vadim <[hidden email]>
Gesendet: Samstag, 9. Februar 2019 11:41
An: [hidden email]
Betreff: Re: [mkgmap-dev] Artifacts in final map (.MP -> .IMG conversion)

Hi Gerd!

Great job!
I checked several .MP files - everything works properly.

By the way, an interesting comparison of cGPSmapper and Mkgmap output files:
Example1:
cGPSmapper
http://a.radikal.ru/a43/1902/62/573d37c22161.png
Mkgmap
http://c.radikal.ru/c30/1902/7e/5e51e8915bb6.png

Example2:
cGPSmapper
http://b.radikal.ru/b11/1902/44/25150c628d84.png
Mkgmap
http://d.radikal.ru/d27/1902/45/f73efd557e06.png

As you can see, there are practically no gaps between polygons in files
created with Mkgmap.

That's why I became interested in using your program.
Thank you so much!



--
Sent from: http://gis.19327.n8.nabble.com/Mkgmap-Development-f5324443.html
_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Reply | Threaded
Open this post in threaded view
|

Re: Artifacts in final map (.MP -> .IMG conversion)

Vadim
In reply to this post by Gerd Petermann
Hi Gerd!

Yes, you can.

BUT the source data for creating this file is not collected by me.
This data comes with the program ReefMaster (https://reefmaster.com.au).
I just created a map in the trial version of this program, saved it in .KMZ
and converted it to .MP.

Therefore, it is better to ask the author of the program on his forum:
https://reefmaster.com.au/index.php/forum/profile/45-matt
I am sure that he will not refuse.

Just change the copyright field and comments in MP file to the
"https://reefmaster.com.au"

ЗЫ: By the way, do not forget to make a generalization (in GPSmapEdit) of
the source MP-file - this will greatly reduce its size.



--
Sent from: http://gis.19327.n8.nabble.com/Mkgmap-Development-f5324443.html
_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Reply | Threaded
Open this post in threaded view
|

Re: Artifacts in final map (.MP -> .IMG conversion)

Vadim
In reply to this post by Gerd Petermann
Hi Gerd

Thanks for options! I'll try them later.

About the program used to create .MP

There are several programs.
As I wrote above, the map is created in the RiffMaster and saved in KMZ
format.

At the next stage, using a self-writing program, I convert this .KMZ file to
.MP.
(https://www.rusfishing.ru/forum/threads/konverter-vektornyx-kart-reefmaster-kmz-garmin-img.360704/)



--
Sent from: http://gis.19327.n8.nabble.com/Mkgmap-Development-f5324443.html
_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev