I am trying to develop a web portal using ol5 API where user click on map and then it takes map click event coordinates as centroid of rectangle and create a rectangle of particular height and width.

Here is the code to create square

image: new ol.style.RegularShape({
        fill: fill,
        points: 4,
        radius: 30,
        angle: Math.PI / 4

But I want to create rectangle with center point, height and width. How to achieve this?

  • 1
    Yes, it is. Do you have a more specific question? – bugmenot123 May 22 '19 at 11:30
  • What software or language are you using to develop with? – Zachary Ordo - GISP May 22 '19 at 20:49
  • i am using openlayer 5 API. – sanju verma May 23 '19 at 5:14
  • Are height and width in pixels or meters? – TomazicM May 23 '19 at 6:06
  • height and width in meter. – sanju verma May 23 '19 at 6:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.