Re: [mkgmap-dev] [PATCH v1] add-pois-to-lines

2011-10-28 Thread Chris66
HI,

thanks for fast implementing, but I have trouble applying
this patch to trunk:

patch -p0 < lines2poi_v1.patch
(Stripping trailing CRs from patch.)
patching file Areas2POIHook.java
Hunk #1 FAILED at 52.
Hunk #2 FAILED at 166.
Hunk #3 FAILED at 236.
3 out of 3 hunks FAILED -- saving rejects to file Areas2POIHook.java.rej


Chris


___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


Re: [mkgmap-dev] [PATCH v1] add-pois-to-lines

2011-10-28 Thread Marko Mäkelä
On Fri, Oct 28, 2011 at 09:46:07AM +0200, Chris66 wrote:
>thanks for fast implementing, but I have trouble applying
>this patch to trunk:
>
>patch -p0 < lines2poi_v1.patch
>(Stripping trailing CRs from patch.)

Just a quick guess without looking at the patch: did you try patch -lp0 
to ignore white space differences?

Marko
___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


Re: [mkgmap-dev] [PATCH v1] add-pois-to-lines

2011-10-28 Thread Chris66
Am 28.10.2011 10:04, schrieb Marko Mäkelä:
> On Fri, Oct 28, 2011 at 09:46:07AM +0200, Chris66 wrote:
>> thanks for fast implementing, but I have trouble applying
>> this patch to trunk:
>>
>> patch -p0 < lines2poi_v1.patch
>> (Stripping trailing CRs from patch.)
> 
> Just a quick guess without looking at the patch: did you try patch -lp0 
> to ignore white space differences?
> 
>   Marko

Hi,
I will try this.

What's the original file size of the patch?
After saving from email it has 6452 Bytes.

Chris


___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


[mkgmap-dev] Error: "boundary directory does not exist"

2011-10-28 Thread Hendrik Oesterlin
Hello,

I updated to r2062 without changing my custom files.

while generating the baselayer, there is the following error message:

GRAVE (LocationHook): ..\osmdata\ncxapi.osm: Disable LocationHook because bounda
ry directory does not exist. Dir: bounds

(the file ncxapi.osm is generated by osmosis using the geofabrik
extract for New Caledonia. I only conserved the "xapi" in the name as
long time ago I used xapi to download the data)

The map seems to work however. (pois-to-area-placement is great!)

Any ideas what this means and how to avoid this?

Regards
Hendrik

___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


Re: [mkgmap-dev] [PATCH v1] add-pois-to-lines

2011-10-28 Thread Chris66
Am 28.10.2011 10:40, schrieb Chris66:

>> Just a quick guess without looking at the patch: did you try patch -lp0 
>> to ignore white space differences?

> I will try this.

This did not help.
OS: Ubuntu 11.04

Filesize of the unpatched Area2PoiHook.java : 7890

Chris

___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


Re: [mkgmap-dev] [PATCH v1] add-pois-to-lines

2011-10-28 Thread Steve Ratcliffe

Hi


Just a quick guess without looking at the patch: did you try patch -lp0
to ignore white space differences?


It doesn't apply for me either. This is because the existing file has 
DOS line endings, whereas the patch has UNIX line-endings. If you add a 
CR (^M) to every line *except* for the diff control lines then it will 
apply.


I've attached the result.

..Steve
Index: src/uk/me/parabola/mkgmap/reader/osm/Areas2POIHook.java
===
--- src/uk/me/parabola/mkgmap/reader/osm/Areas2POIHook.java	(revision 2063)
+++ src/uk/me/parabola/mkgmap/reader/osm/Areas2POIHook.java	(working copy)
@@ -52,6 +52,8 @@
 	
 	/** Name of the bool tag that is set to true if a POI is created from an area */
 	public static final String AREA2POI_TAG = "mkgmap:area2poi";
+	public static final String LINE2POI_TAG = "mkgmap:line2poi";
+	public static final String LINE2POI_TYPE_TAG  = "mkgmap:line2poitype";
 	
 	public boolean init(ElementSaver saver, EnhancedProperties props) {
 		if (props.containsKey("add-pois-to-areas") == false) {
@@ -166,62 +168,130 @@
 		log.debug("Found", labelCoords.size(), "label coords");
 		
 		int ways2POI = 0;
+		int lines2POI = 0;
 		
 		for (Way w : saver.getWays().values()) {
-			// check if it is an area
-			if (w.isClosed() == false) {
+			// check if way has any tags
+			if (w.getTagCount() == 0) {
 continue;
 			}
 
-			if (w.getTagCount() == 0) {
-continue;
-			}
-			
 			// do not add POIs for polygons created by multipolygon processing
 			if (w.isBoolTag(MultiPolygonRelation.MP_CREATED_TAG)) {
 log.debug("MP processed: Do not create POI for", w.toTagString());
 continue;
 			}
 			
-			// get the coord where the poi is placed
-			Coord poiCoord = null;
-			// do we have some labeling coords?
-			if (labelCoords.size() > 0) {
-int poiOrder = Integer.MAX_VALUE;
-// go through all points of the way and check if one of the coords
-// is a labeling coord
-for (Coord c : w.getPoints()) {
-	Integer cOrder = labelCoords.get(c);
-	if (cOrder != null && cOrder.intValue() < poiOrder) {
-		// this coord is a labeling coord
-		// use it for the current way
-		poiCoord = c;
-		poiOrder = cOrder;
-		if (poiOrder == 0) {
-			// there is no higher order
-			break;
-		}
+			
+			// check if it is an area
+			if (w.isClosed()) {
+addPOItoPolygon(w, labelCoords);
+ways2POI++;
+			} else {
+lines2POI += addPOItoLine(w);
+			}
+		}
+		
+		log.error(ways2POI+ " POIs from single areas created");
+		log.error(lines2POI+ " POIs from lines created");
+	}
+	
+	private void addPOItoPolygon(Way polygon, Map labelCoords) {
+		// get the coord where the poi is placed
+		Coord poiCoord = null;
+		// do we have some labeling coords?
+		if (labelCoords.size() > 0) {
+			int poiOrder = Integer.MAX_VALUE;
+			// go through all points of the way and check if one of the coords
+			// is a labeling coord
+			for (Coord c : polygon.getPoints()) {
+Integer cOrder = labelCoords.get(c);
+if (cOrder != null && cOrder.intValue() < poiOrder) {
+	// this coord is a labeling coord
+	// use it for the current way
+	poiCoord = c;
+	poiOrder = cOrder;
+	if (poiOrder == 0) {
+		// there is no higher order
+		break;
 	}
 }
 			}
-			if (poiCoord == null) {
-// did not find any label coord
-// use the common center point of the area
-poiCoord = w.getCofG();
+		}
+		if (poiCoord == null) {
+			// did not find any label coord
+			// use the common center point of the area
+			poiCoord = polygon.getCofG();
+		}
+		
+		Node poi = createPOI(polygon, poiCoord, AREA2POI_TAG); 
+		saver.addNode(poi);
+	}
+	
+	private int addPOItoLine(Way line) {
+		Node startNode = createPOI(line, line.getPoints().get(0), LINE2POI_TAG);
+		startNode.addTag(LINE2POI_TYPE_TAG,"start");
+		saver.addNode(startNode);
+
+		Node endNode = createPOI(line, line.getPoints().get(line.getPoints().size()-1), LINE2POI_TAG);
+		endNode.addTag(LINE2POI_TYPE_TAG,"end");
+		saver.addNode(endNode);
+
+		int noPOIs = 2;
+		
+		if (line.getPoints().size() > 2) {
+			for (Coord inPoint : line.getPoints().subList(1, line.getPoints().size()-1)) {
+Node innerNode = createPOI(line, inPoint, LINE2POI_TAG);
+innerNode.addTag(LINE2POI_TYPE_TAG,"inner");
+saver.addNode(innerNode);
+noPOIs++;
 			}
-			
-			Node poi = new Node(FakeIdGenerator.makeFakeId(), poiCoord);
-			poi.copyTags(w);
-			poi.deleteTag(MultiPolygonRelation.STYLE_FILTER_TAG);
-			poi.addTag(AREA2POI_TAG, "true");
-			log.debug("Create POI",poi.toTagString(),"from",w.getId(),w.toTagString());
-			saver.addNode(poi);
-			ways2POI++;
 		}
 		
-		log.info(ways2POI, "POIs from single areas created");
+		
+		// calculate the middle of the line
+		Coord prevC = null;
+		double sumDist = 0.0;
+		ArrayList dists = new ArrayList(line.getPoints().size()-1);
+		for (Coord c : line.getPoints()) {
+			if (prevC != null) {
+

Re: [mkgmap-dev] [PATCH v1] add-pois-to-lines

2011-10-28 Thread Chris66
Am 28.10.2011 13:12, schrieb Steve Ratcliffe:

> It doesn't apply for me either. This is because the existing file has
> DOS line endings, whereas the patch has UNIX line-endings. If you add a
> CR (^M) to every line *except* for the diff control lines then it will
> apply.

Hi,
thanks, another solution is dos2unix the java and the patch file before
applying.
Chris

___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


Re: [mkgmap-dev] [PATCH v1] add-pois-to-lines

2011-10-28 Thread Chris66
Hi,
what did I wrong?

I used the commands from the mkgmap dev wiki:

ant clean
ant dist
copied the dist/mkgmap.jar over my regular mkgmap.jar.

File size : 1.738.428 Bytes

Error at line 1, col 1
Error at line 1, col 1
Bad file format: c:\apps\mymap\osmsplit\1001.osm.pbf
Error parsing file
Bad file format: c:\apps\mymap\osmsplit\1002.osm.pbf
Error parsing file
Exception in thread "main" java.lang.NullPointerException
at 
uk.me.parabola.mkgmap.combiners.FileInfo.getFileInfo(FileInfo.java:139)
at uk.me.parabola.mkgmap.main.Main.endOptions(Main.java:426)
at
uk.me.parabola.mkgmap.CommandArgsReader.readArgs(CommandArgsReader.java:126)
at uk.me.parabola.mkgmap.main.Main.main(Main.java:130)

Chris

___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


Re: [mkgmap-dev] [PATCH v1] add-pois-to-lines

2011-10-28 Thread Chris66
Am 27.10.2011 20:51, schrieb WanMil:

> I am very undecided if this option is reasonable or not.

Yes, I think it's usefull, because you can do some tricks you can
not do without this option.

So, first Test :

error file shows that POIs have been created :

SCHWERWIEGEND (Areas2POIHook): c:\apps\mymap\osmsplit\data.osm: 1991
POIs from single areas created
SCHWERWIEGEND (Areas2POIHook): c:\apps\mymap\osmsplit\data.osm: 19040
POIs from lines created
SCHWERWIEGEND (Areas2POIHook): c:\apps\mymap\osmsplit\data.osm: 33 POIs
from multipolygons created

But I don't see the icons on my map.

I added the lines

highway=* & (hgv=no | hgv=destination) [0x7005 resolution 20]
highway=* & (maxheight < 4)  [0x7005 resolution 20]
highway=* & (maxweight < 12) [0x7005 resolution 20]

to the points file and created an icon "hgv no" with the Typ Editor.


Chris



___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


Re: [mkgmap-dev] [PATCH v1] add-pois-to-lines

2011-10-28 Thread Chris66
Am 28.10.2011 17:33, schrieb Chris66:

> But I don't see the icons on my map.

Sorry, my fault, after zooming in I see the icons.
So it works. ;-)

Chris

___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


Re: [mkgmap-dev] [PATCH v1] add-pois-to-lines

2011-10-28 Thread Torsten Leistikow
Moin,

Chris66 schrieb am 28.10.2011 17:52:
> So it works.

Can you please provide your mkgmap.jar file? I do not have a development
environment for mkgmap at the moment but would like to try out the patch.

Gruss
Torsten
___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


Re: [mkgmap-dev] [PATCH v1] add-pois-to-lines

2011-10-28 Thread Chris66
Am 28.10.2011 18:09, schrieb Torsten Leistikow:

>> So it works.
> 
> Can you please provide your mkgmap.jar file? I do not have a development
> environment for mkgmap at the moment but would like to try out the patch.

Hi Torsten,

I can do that, but it won't work with pbf files, because I don't know
how to build with pbf support (see my post of 16:55).

Screenshot:


Showing the maxheight as popup info.

Chris


___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


Re: [mkgmap-dev] [PATCH v1] add-pois-to-lines

2011-10-28 Thread WanMil
I have uploaded it to http://files.mkgmap.org.uk/detail/39

WanMil


> Am 28.10.2011 18:09, schrieb Torsten Leistikow:
>
>>> So it works.
>>
>> Can you please provide your mkgmap.jar file? I do not have a development
>> environment for mkgmap at the moment but would like to try out the patch.
>
> Hi Torsten,
>
> I can do that, but it won't work with pbf files, because I don't know
> how to build with pbf support (see my post of 16:55).
>
> Screenshot:
>
> 
> Showing the maxheight as popup info.
>
> Chris
>
>
> ___
> mkgmap-dev mailing list
> mkgmap-dev@lists.mkgmap.org.uk
> http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


Re: [mkgmap-dev] Option : Need of drive-on-left option ?

2011-10-28 Thread Marko Mäkelä
On Thu, Oct 27, 2011 at 12:41:12AM +0200, fla...@googlemail.com wrote:
>If you use the option --check-roundabouts you candefine -drive-on-left 
>or --drive-on-right.
>But if you have input data from more than one country this is sometimes 
>not easy to define.
>
>But in the past more and more people use the bounds option. Cant be 
>decide on with side of the road we should drive from the infos out of a 
>bounds file ?

I think that the option should be preserved for those who are not able 
to use a bounds file (e.g., if the bounds are missing or broken in the 
area). But, there could be a third option value, asking mkgmap to derive 
the setting from the country bounds.

Best regards,

Marko
___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev