WordPress.org

Support

Support » Plugins and Hacks » OS Openspace Maps – not centred on marker

OS Openspace Maps – not centred on marker

Viewing 5 replies - 1 through 5 (of 5 total)
  • purediamox
    Member

    @purediamox

    There are 2 undocumented parameters for centering and zooming the map – centre and zoom. These seem to be necessary when only having markers i.e. no gpx file.

    Example:

    [osmap zoom=”6″ centre=”SH60985437″ markers=”SH60985437;Snowdon”]

    PeteMeredith
    Member

    @petemeredith

    I have tried adding those parameters with no success. The shortcode now reads:

    [osmap centre=”53.115000,-2.546000″ zoom=”4″ markers=”53.115000,-2.546000;RACUNDRA at Venetian Marina”]

    I think perhaps it is the Lat/Lon that is the problem.

    purediamox
    Member

    @purediamox

    Yes, it looks to be an issue with lat/long. Seems to work fine, but only if both the centre and the markers are grid references

    [osmap centre="SJ6355257675" zoom="4" markers="53.115000,-2.546000;RACUNDRA at Venetian Marina"]

    marker is at correct place, but still centres on Berwick.

    [osmap centre="SJ6355257675" zoom="4" markers="SJ6355257675;RACUNDRA at Venetian Marina"]

    works.

    I noticed there is some javascript code to attempt to centre the map, if no centre parameter is supplied, and it obviously does work for GPX. I only need grid references, so I’ll not dig further into this.

    PeteMeredith
    Member

    @petemeredith

    It seems to work if I put two markers close together. I think the problem is to do with calculating the extent of the map required to show markers / track etc. When the only feature is a single marker the extent is a single point. Still this doesn’t explain why it works for grid references.

    I don’t have time at the moment to work out how WordPress plugins work and get up to speed with the Javascript, and anyway it may be a problem with the OpenSpace API.

    The problem will go away when I have more data to display.

    Adrian
    Participant

    @adriandw

    I have the same problem.
    I’m sure it used to work, but I just noticed that the map is centred on Berwick if I define a single marker using Lat/Long.
    If I change the code to use a grid reference, then it works as expected.

    This one displays OK
    [osmap height="275" width ="275" markers="SU4679925645; Compton and Shawford"]

    This one centres on Berwick
    [osmap height="275" width ="275" markers="51.028274,-1.334045; Compton and Shawford"]

    I used this handy co-ordinate converter

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘OS Openspace Maps – not centred on marker’ is closed to new replies.