Support » Plugin: OS DataHub Maps » Can’t get different track colours to work

  • Resolved digbymaass

    (@digbymaass)


    I’ve checked everything 50 times and I can’t see where I’m going wrong. The test page shows the top map with gpxstyle=1 in the shortcode which is stopping the gpx loading. The lower map shows it without. It loads but obviously the default colour is not overridden. The right hand side should be red and the left blue. I’m baffled.

    The relevant bits from the gpx file are the first track:

    <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
    <gpx xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.1" xmlns:gpxtpx="http://www.garmin.com/xmlschemas/TrackPointExtension/v1" xmlns="http://www.topografix.com/GPX/1/1" xmlns:rmc="urn:net:trekbuddy:1.0:nmea:rmc" creator="QLandkarteGT 1.0.1.post http://www.qlandkarte.org/" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd http://www.garmin.com/xmlschemas/GpxExtensions/v3 http://www.garmin.com/xmlschemas/GpxExtensionsv3.xsd http://www.garmin.com/xmlschemas/TrackPointExtension/v1 http://www.garmin.com/xmlschemas/TrackPointExtensionv1.xsd http://www.qlandkarte.org/xmlschemas/v1.1 http://www.qlandkarte.org/xmlschemas/v1.1/ql-extensions.xsd" xmlns:gpxx="http://www.garmin.com/xmlschemas/GpxExtensions/v3" xmlns:ql="http://www.qlandkarte.org/xmlschemas/v1.1">
     <metadata>
      <time>2020-05-27T12:18:53Z</time>
     </metadata>
       <trk>  
       <name>Dunbar</name>
       <extensions>
          <line xmlns="http://www.topografix.com/GPX/gpx_style/0/2">
            <color>#0000FF</color>
        </line>
        </extensions>
        <trkseg>
          <trkpt lat="55.994801" lon="-2.555095">
            <ele>17.40000</ele>
            <time>2020-05-27T12:18:53Z</time>

    etc etc

    And the second track following on the first:

    <trk>
      <name>Dunbar cliffs</name>
        <extensions>
          <line xmlns="http://www.topografix.com/GPX/gpx_style/0/2">
            <color>#FF0033</color>
        </line>
        </extensions>
        <trkseg>
          <trkpt lat="56.002331" lon="-2.551789">
            <ele>8.60000</ele>
          </trkpt>

    etc etc

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter digbymaass

    (@digbymaass)

    Inspector showed the # was doubled in the page source – I defined the colour including it in the gpx. So I’ve removed the #.

    Why would it would do that?? Something to do with jQuery version? Everything is bang up to date in the installation

    The instructions clearly say to use the # !

    I think it’s fixed. Took me… a while!

    • This reply was modified 8 months, 3 weeks ago by digbymaass.
    • This reply was modified 8 months, 3 weeks ago by digbymaass.
    • This reply was modified 8 months, 3 weeks ago by digbymaass.
    • This reply was modified 8 months, 3 weeks ago by digbymaass.
    • This reply was modified 8 months, 3 weeks ago by digbymaass.
    • This reply was modified 8 months, 3 weeks ago by digbymaass.
    Thread Starter digbymaass

    (@digbymaass)

    By the way – can you pass opacity as an attribute for one of the tracks?

    Thread Starter digbymaass

    (@digbymaass)

    No; I see it’s set, and <opacity> is overidden by the L.GPX constructor.

    Though I’ve just found that adding opacity=1 to the multi-track shortcode works. Adding opacity=”1″ with the quote marks works in the single track map but disables the multi track map.

    Plugin Author skirridsystems

    (@skirridsystems)

    Thanks for reporting this. My documentation was clearly wrong as I did not include the # in my own example file. I’ve corrected this now.

    I don’t understand the question about opacity. It works for me with or without quotes in the shortcode. There is currently no option to take opacity from the GPX file.

    Thread Starter digbymaass

    (@digbymaass)

    Nor me! It seems to be working with or without quotes on both maps now!

    I’m just trying the marker. Can’t seem to change the colour to eg red.
    Is this correct? markers="55.99466,-2.55505 ! red; Parking - Start"

    OS data hub is terrible. I’d hoped to get some clues about markers and things there (and I’ve also been making OS tiled leaflet maps separately from the plugin). Doesn’t seem to be any choice at all about marker style.
    And they seem to have removed most of their examples and tutorials. I hope they aren’t ditching the whole thing.

    Thread Starter digbymaass

    (@digbymaass)

    Ah… take out the spaces and the marker colour works – markers="55.99466,-2.55505!red;Parking - Start"

    Plugin Author skirridsystems

    (@skirridsystems)

    You need to get rid of the spaces around the !

    OS Data Hub only supplies the map tiles. The markers are all done by the mapping code, in my case Leaflet.js. That doesn’t support coloured markers out of the box and I had to add my own. There are Leaflet plugins to add iconised markers, e.g. ionicons or font awesome, but I just wanted something lightweight.

    I can still see the examples here:
    https://labs.os.uk/public/os-data-hub-examples/os-maps-api/zxy-3857-basic-map
    and here:
    https://labs.os.uk/public/os-data-hub-tutorials/

    Thread Starter digbymaass

    (@digbymaass)

    Thanks! Must stop playing with this now!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Can’t get different track colours to work’ is closed to new replies.