Sagar Rawal
Sagar Rawal

Reputation: 1442

How to find bbox height and width for openlayer3 map

I'm working on openlayer3 map, i had draw one bbox on map, now i want to find height and width of this bbox. Please let me know how to get this. I had already tried map.getPixelFromCordinate but not able to get the size of it.

map with bbox

Yellow color border is bbox, for which i want height and width.

Please help me out.

Upvotes: 1

Views: 397

Answers (1)

Chetan Hirapara
Chetan Hirapara

Reputation: 694

For getting heigh&width of bbox you can follow this way.

1) pass one by one coordinate to map.getPixelFromCordinate(), this will returns pixels.

2) subtract two pixels for x coordinate as well as y. this will be height and width for that zoom level.

Upvotes: 2

Related Questions