Discussion Board

Results 1 to 4 of 4

Thread: getCenter()

  1. #1
    Registered User
    Join Date
    Jul 2013
    Posts
    12

    getCenter()

    Is there simple way to find the centre of a web map? I have tried map.getCenter() as I would in OpenLayers etc but this does not seem to work. Thanks

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,184

    Re: getCenter()

    What have you sen being wrong with teh value gotten ?

  3. #3
    Regular Contributor
    Join Date
    Aug 2011
    Location
    Berlin
    Posts
    289

    Re: getCenter()

    To get the bounding box of the mapView (i.e the area you see on screen) you can use: map.getViewBounds(), if you chain this with the getCenter() function of the BoundingBox i.e map.getBoundingBox().getCenter() you will find the coordinate at the centre of the viewport.

  4. #4
    Registered User
    Join Date
    Aug 2013
    Posts
    1

    Re: getCenter()

    I had the same problem. I think the solution is:
    var myMapCenter=map.getViewBounds().getCenter();

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×