Web application has option that user draws polyline on Google Map. After he draws it, there is a button 'Add polygons', which should draw polygons along that line, based on some width and height in meters. After polygons are drawn, polyline should be removed. All polygons should have right side joined with next one (should share one side with next one). I don't know from where should I start, is it possible to draw polygon based on distance (m) from line, how to draw polygons so that they share one side?

It's clear that upper and bottom side won't be the same, that doesn't matter. Width doesn't have to be exact.

This is polyline:

myPath = new google.maps.Polyline({
                        path: flightPlanCoordinates,
                        geodesic: true,
                        strokeColor: '#FF0000',
                        strokeOpacity: 1.0,
                        strokeWeight: 4,
                        editable: true

This is fast sketch, just to get an idea what I'm talking about.enter image description here

  • 1
    How are you wanting to interpolate along the line? Should it be an interval, like 10% of the line length, or should it be a set, user-defined value? – elrobis Oct 14 '14 at 14:44

you could draw rectangles with points in the line drawn acting as a center for each rectangle something like what has been asked here

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.