logo separator

[mkgmap-dev] leading and trailing spaces

From Gerd Petermann gpetermann_muenchen at hotmail.com on Sat Jan 31 10:23:15 GMT 2015

Hi Mike,

committed with r3435.
I had to modify one of the unit tests, please remember to run 
ant test 
and check the results when you post a patch.
I also hesitated because we are now trimming the values before we
actually know if they are used at all, but the performance implication
seems very small.
I really don't like this repeated code around the keepTag() call in three readers.
I think it should be possible to implement something like
void addTagIfUsed(Element e, String tag, String val)
which combines the code. 

Gerd

From: mike at tvage.co.uk
To: mkgmap-dev at lists.mkgmap.org.uk
Date: Fri, 30 Jan 2015 11:25:25 +0000
Subject: Re: [mkgmap-dev] leading and trailing spaces

Hi Gerd, good point. There isn’t any single place that can fix for all the input formats as far as I can see. The attached patch separately updates each of the readers. Regards,Mike From: Gerd Petermann [mailto:gpetermann_muenchen at hotmail.com] 
Sent: 29 January 2015 15:03
To: mkgmap-dev at lists.mkgmap.org.uk
Subject: Re: [mkgmap-dev] leading and trailing spaces Hi Mike,

I'd prefer a patch that changes the behaviour also for xml and o5m input,
not just for *.pbf.  Maybe you find a place where this can be done once for
all sources?

GerdFrom: mike at tvage.co.uk
To: mkgmap-dev at lists.mkgmap.org.uk
Date: Thu, 29 Jan 2015 12:10:40 +0000
Subject: Re: [mkgmap-dev] leading and trailing spacesHi Gerd, you are right; trim() removes all leading and trailing characters
that are less than 0x20. However, the place I mention is reading the raw OSM
data before any styles have been applied, so this should not be a problem.
 
I agree with Paco that ideally the OSM data should be corrected, but that
will always be playing catch up, so I think it is best to also remove them
in the mkgmap processing. I have corrected a number of local ones in OSM,
but there are too many to correct them all manually.
 
I've attached a patch that seems to be OK to me. Please give it a try.
 
Regards,
Mike
 
-----Original Message-----
From: GerdP [mailto:gpetermann_muenchen at hotmail.com] 
Sent: 29 January 2015 06:18
To: mkgmap-dev at lists.mkgmap.org.uk
Subject: Re: [mkgmap-dev] leading and trailing spaces
 
Hi Mike,
 
I can't find it now, but I seem to remember a comment that
trim() should be used with great care as it removes the highway shield
codes.
 
Gerd
 
 
Mike Baggaley wrote
> Good evening all,
> 
> I've noticed that there are a number of unwanted leading and trailing
> spaces
> in OSM data. You can get a list of the ones on the name field using the
> following:
> 
> name~'.* ' {echotags "name ends with a space"}
> name~' .*' {echotags "name starts with a space"}
> 
> I can't see any facility in mkgmap to remove these, and was wondering
> whether the best way would be simply to code them out by replacing the
> following line in parseDense, parseNodes, ParseWays and parseRelations:
> 
> String val = getStringById(...);
> 
> With
> 
> String val = getStringById(...).trim();
> 
> I can't think of any reason why a value would need to start or end with a
> space, so it seems reasonable to just remove them. Are there any other
> suggestions, or reasons why this should not be done?
> 
> Regards,
> Mike
> 
> _______________________________________________
> mkgmap-dev mailing list
 
> mkgmap-dev at .org
 
> http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
 
 
 
 
 
--
View this message in context:
http://gis.19327.n5.nabble.com/leading-and-trailing-spaces-tp5831778p5831782
.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 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mkgmap.org.uk/pipermail/mkgmap-dev/attachments/20150131/8865c6ab/attachment.html>


More information about the mkgmap-dev mailing list