Draw Rectangle on any map

How to add a functionality on a map using javascript that enables draw shapes like rectangle on the map ?

Are you drawing on a canvas?

No sir I want to create a webapi that enables drawing shapes on maps
something like this :- http://openlayers.org/en/latest/examples/draw-shapes.html

That is a canvas.

Is that the map you’re dealing with? How to draw things on a map depends entirely on the map.

I have previously worked on Google maps to draw shapes on their map system.
It´s well documented: https://developers.google.com/maps/documentation/javascript/shapes

You have to tell us more about your map and your web API.
Is it an external map source or did you create your own?
Remember that you can still use canvas to draw things on top of things. You simply have to create a javascript package/module that the programmer can interact with (API =) )

the map is from an external source.

the map that I will be using is this:- https://maps.mapmyindia.com/@jqiofalfl,ooilfjavf,lj,l,f,fzdata
API of this map is available to me from the website.

You’ll need to refer to that API to know what drawing capabilities are available to you to use.

1 Like