WordPress.org

Forums

OS OpenSpace Maps
OS Openspace Maps - not centred on marker (6 posts)

  1. PeteMeredith
    Member
    Posted 1 year ago #

    The shortcode: [osmap markers="53.115,-02.546;RACUNDRA at Venetian Marina"] creates a Marker in the correct place but the map is centred at Berwick-upon-Tweed. This seems like a fault or am I missing something. The page is at:

    http://puffinrock.co.uk/racundra/route/

    https://wordpress.org/plugins/os-openspace-maps/

  2. purediamox
    Member
    Posted 1 year ago #

    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"]

  3. PeteMeredith
    Member
    Posted 1 year ago #

    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.

  4. purediamox
    Member
    Posted 1 year ago #

    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.

  5. PeteMeredith
    Member
    Posted 1 year ago #

    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.

  6. Adrian
    Member
    Posted 1 year ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • OS OpenSpace Maps
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic