angular-google-maps icon indicating copy to clipboard operation
angular-google-maps copied to clipboard

How to access drawn object and its properties

Open jcox86 opened this issue 12 years ago • 1 comments

Hi, I'm pretty sure my issue is related to #803, as once I am done drawing a shape on the map, I need to save all the latitudes and longitudes used to create the object.

However, I see no way to access an object that has been drawn with the drawing manager. Is it put into a generic collection of objects somewhere? How can I access the drawn object from a custom control on the map like a button click?

I found some code from the Google API docs where I can add an event listener and in the event there is a getPath() function that gives me all the coordinates of the shape I created. From this I am also able to get the Area of the shape I created by calling the computeArea() method. However this is not working as intended as it is not 'Angular' and has it's own set of problems.

I would like to have the area of the shape I create displayed on the map in a custom control as well as save all the coordinates to my database for future use, and possibly clear out what was done before to start over or make changes. I feel like I am missing something here, everything else about this has been a breeze. Thanks

jcox86 avatar Dec 02 '14 00:12 jcox86

Look at FreeDraw and copy some of its implementation. Currently there is no angular backend to the DrawingManager to share the state. IE if you want the state from the DrawingManager currently you need access the google objects and do it the manual way.

To make it angular a lot of stuff can be copied and improved upon from FreeDraw and I welcome the improvements.

nmccready avatar Dec 02 '14 18:12 nmccready