logo separator

[mkgmap-dev] mkgmap r2179: Still NullPointerException in BoundaryUtil

From Gerd Petermann gpetermann_muenchen at hotmail.com on Wed Jan 25 07:37:44 GMT 2012








I think the problem is in the Java2DConverter.areaToShapes() method which rounds the float values to int. 
This is not a problem for the boundaries that are created with OSM points, but with areas 
created with Area.intersect()  or Area.substract() we see some points with fractions. 
In Way we are using these rounded values to calculate the area size and determine whether the way 
is clockwise or counter-clockwise.
Sometimes the rounding error is too big (bigger than the area size), so the clockwise() method returns 
wrong results.

I have coded a quick hack with coords stored in floats, and this seems to fix the problem, but I find many 
other places where this problem might show up, so I'll continue searching for a real solution.

Gerd


> Date: Tue, 24 Jan 2012 22:50:07 +0100
> From: wmgcnfg at web.de
> To: mkgmap-dev at lists.mkgmap.org.uk
> Subject: Re: [mkgmap-dev] mkgmap r2179: Still NullPointerException in	BoundaryUtil
> 
> Rather the same method is implemented in 
> Multipolygon.calcAreaSize(List<Coord> points). Maybe the two methods can 
> be merged to use the same area calculation. The Multipolygon variant 
> uses doubles. Maybe the fixes it.
> 
> I don't mind moving the calculation from the Multipolygon class to a 
> better util class.
> 
> WanMil
> 
> > Hi WanMil,
> >
> > I verified the result of the area calculation with a slightly different
> > algorithm that I found in the net,
> > that produced always exactly the same result.
> > Maybe it is not a good idea to use integer/long values for this. I'll
> > continue investigation with this tomorrow.
> >
> > ciao,
> > Gerd
> >
> >  > Date: Tue, 24 Jan 2012 22:30:50 +0100
> >  > From: wmgcnfg at web.de
> >  > To: mkgmap-dev at lists.mkgmap.org.uk
> >  > Subject: Re: [mkgmap-dev] mkgmap r2179: Still NullPointerException in
> > BoundaryUtil
> >  >
> >  > Hi,
> >  >
> >  > in case your are right Gerd (I have no time today to check that in
> >  > deep), it is a bug of the clockwise method. So this method needs a
> >  > bugfix - not the parts that use the method clockwise method.
> >  >
> >  > WanMil
> >  >
> >  > > Hi Thorsten,
> >  > >
> >  > > I can confirm this problem. I can repdroduce it with a "boundary" which
> >  > > contains these 4 points:
> >  > > [2412980/371559, 2412981/371558, 2412992/371544, 2412980/371559]
> >  > > The Way.clockwise() method says it is counter-clockwise.
> >  > > Besides rounding errors, it is a line, not a shape, and I guess
> > that causes
> >  > > the problem. The clockwise() method calculates an area size of 3,
> > which is
> >  > > almost zero.
> >  > >
> >  > > It is quite likely that the intersection of two areas produces
> > these "nearly
> >  > > empty" (parts of) areas, what we need is a filter that throws them
> > away.
> >  > >
> >  > > I am not sure if WanMil is already working on this?
> >  > >
> >  > > Gerd
> >  > >
> >  > >
> >  > > Thorsten Kukuk wrote
> >  > >>
> >  > >> Hi,
> >  > >>
> >  > >> I compiled mkgmap r2179 and tried to create the bounds files with
> >  > >> it:
> >  > >>
> >  > >> osmconvert data/planet/planet-120122.osm.pbf --out-o5m
> >  > >> osmfilter data/boundaries/world-20120122.o5m --keep-nodes=
> >  > >> '--keep-ways-relations=boundary=administrative =postal_code
> > postal_code='
> >  > >> mkgmap --createboundsfile=data/boundaries/boundaries-20120122.osm.gz
> >  > >> --bounds=data/boundaries/20120122
> >  > >> Schwerwiegend (BoundarySaver): Calculate bbox to
> >  > >> (-90.12222290039062,-180.24444580078125) to
> >  > >> (82.6120376586914,179.17156219482422)
> >  > >> Exception in thread "main" java.lang.NullPointerException
> >  > >> at
> >  > >>
> > uk.me.parabola.mkgmap.reader.osm.boundary.BoundaryUtil.loadBoundaryFile(BoundaryUtil.java:169)
> >  > >> at
> >  > >>
> > uk.me.parabola.mkgmap.reader.osm.boundary.BoundaryPreparer.workoutBoundaryRelations(BoundaryPreparer.java:144)
> >  > >> at
> >  > >>
> > uk.me.parabola.mkgmap.reader.osm.boundary.BoundaryPreparer.run(BoundaryPreparer.java:110)
> >  > >> at uk.me.parabola.mkgmap.main.Main.endOptions(Main.java:333)
> >  > >> at
> >  > >>
> > uk.me.parabola.mkgmap.CommandArgsReader.readArgs(CommandArgsReader.java:126)
> >  > >> at uk.me.parabola.mkgmap.main.Main.main(Main.java:112)
> >  > >> Command exited with non-zero status 1
> >  > >>
> >  > >>
> >  > >> Thorsten
> >  > >>
> >  > >> --
> >  > >> Thorsten Kukuk, Project Manager/Release Manager SLES
> >  > >> SUSE LINUX Products GmbH, Maxfeldstr. 5, D-90409 Nuernberg
> >  > >> GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG
> > Nürnberg)
> >  > >> _______________________________________________
> >  > >> mkgmap-dev mailing list
> >  > >> mkgmap-dev at .org
> >  > >> http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
> >  > >>
> >  > >
> >  > >
> >  > > --
> >  > > View this message in context:
> > http://gis.638310.n2.nabble.com/mkgmap-r2179-Still-NullPointerException-in-BoundaryUtil-tp7215004p7220841.html
> >  > > Sent from the Mkgmap Development mailing list archive at Nabble.com.
> >  > > _______________________________________________
> >  > > mkgmap-dev mailing list
> >  > > mkgmap-dev at lists.mkgmap.org.uk
> >  > > http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
> >  >
> >  > _______________________________________________
> >  > mkgmap-dev mailing list
> >  > mkgmap-dev at lists.mkgmap.org.uk
> >  > http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
> >
> >
> > _______________________________________________
> > mkgmap-dev mailing list
> > mkgmap-dev at lists.mkgmap.org.uk
> > http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
> 
> _______________________________________________
> mkgmap-dev mailing list
> mkgmap-dev at lists.mkgmap.org.uk
> http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.mkgmap.org.uk/pipermail/mkgmap-dev/attachments/20120125/85d64f30/attachment.html 


More information about the mkgmap-dev mailing list