1 [[!template id=gitbranch branch=cbaines/osm-popup-fixes author="[[cbaines]]"]]
4 When using the GeoJSON output of the OSM plugin (osm_format: GeoJSON), the name and description in the popups are missing, this patch fixes the issue.
6 > "Pass the layers given in the OSM directive through"
8 > It would be good if the commit added documentation for the new feature,
9 > probably in `doc/ikiwiki/directive/osm.mdwn`.
11 > + my @layers = [ 'OSM' ];
13 > You mean `$layers`. `[]` is a scalar value (a reference to an array);
14 > `@something` is an array.
16 > + @layers = [ split(/,/, $params{layers}) ];
18 > Is comma-separated the best fit here? Would whitespace, or whitespace and/or
19 > commas, work better?
21 > It's difficult to compare without knowing what the values would look like.
22 > What would be valid values? The documentation for `$config{osm_layers}`
23 > says "in a syntax acceptable for OpenLayers.Layer.OSM.url parameter" so
26 > # expected by current branch
27 > \[[!osm layers="OSM,WTF,OMG"]]
28 > \[[!osm layers="http://example.com/${z}/${x}/${y}.png,http://example.org/tiles/${z}/${x}/${y}.png"]]
29 > # current branch would misbehave with this syntax but it could be
31 > \[[!osm layers="OSM, WTF, OMG"]]
32 > \[[!osm layers="""http://example.com/${z}/${x}/${y}.png,
33 > http://example.org/tiles/${z}/${x}/${y}.png"""]]
34 > # I would personally suggest whitespace as separator (split(' ', ...))
35 > \[[!osm layers="OSM WTF OMG"]]
36 > \[[!osm layers="""http://example.com/${z}/${x}/${y}.png
37 > http://example.org/tiles/${z}/${x}/${y}.png"""]]
39 > If you specify more than one layer, is it like "get tiles from OpenCycleMap
40 > server A or B or C as a round-robin", or "draw OpenCycleMap and then overlay
41 > county boundaries and then overlay locations of good pubs", or what?
43 > + layers => @layers,
45 > If @layers didn't have exactly one item, this would mess up argument-parsing;
46 > but it has exactly one item (a reference to an array), so it works.
47 > Again, if you replace @layers with $layers throughout, that would be better.
49 > - $options{'layers'} = $config{osm_layers};
51 > Shouldn't the default if no `$params{layers}` are given be this, rather
52 > than a hard-coded `['OSM']`?
54 > `getsetup()` says `osm_layers` is `safe => 0`, which approximately means
55 > "don't put this in the web UI, changing it could lead to a security flaw
56 > or an unusable website". Is that wrong? If it is indeed unsafe, then
57 > I would expect changing the same thing via \[[!osm]] parameters to be
60 > I notice that `example => { 'OSM', 'GoogleSatellite' }` is wrong:
61 > it should (probably) be `example => [ 'OSM', 'GoogleSatellite' ]`
62 > (a list of two example values, not a map with key 'OSM' corresponding
63 > to value 'GoogleSatellite'. That might be why you're having trouble
66 > "Fix the title and description of map popups"
68 > + # Rename desc to description (this matches the kml output)
70 > Is there a spec for this anywhere, or a parser with which it needs to be
73 > --[[smcv]] [[!tag reviewed]]