Draw a polygon on google maps with custom plugins

Are you having problems with using or developing a plugin? Let me know here.
Post Reply
ETEJRadar
Posts: 11
Joined: Fri Aug 10, 2018 11:13 am

Draw a polygon on google maps with custom plugins

Post by ETEJRadar » Fri Feb 07, 2020 9:54 pm

Hi. Ì'm playing around with marking the mil-reserved areas in my antenna coverage and I just marked one but with polylines. That was a lot of effort but it was worth it. Then I discovered that you can also do it with a polygon. But my polygon script is not working, my polyline is though.

Polygon Script

Code: Select all

<script type="text/javascript">
    if(VRS && VRS.globalDispatch && VRS.serverConfig) {
        VRS.globalDispatch.hook(VRS.globalEvent.bootstrapCreated, function(bootStrap) {
            // Hook the event that is raised after the page has finished initialising.
            bootStrap.hookInitialised(function(pageSettings) {
                // Check that there's a map on the page
                if(pageSettings.mapPlugin) {
                    // Declare each point in the line that we're going to draw. Note that the
                    // last entry must not have a comma after it.
                    var outlineCoordinates = [
					{lat:  47.9109, lng:  10.3095 },
					{lat:  47.8363, lng:  10.4003 },
					{lat:  47.9266, lng:  11.2339 },
					{lat:  48.2382, lng:  11.1892 },
					{lat:  48.3635, lng:  11.0000 },
					{lat:  47.9109, lng:  10.3095 }
                    ];
                    
                    // Add the line to the map
                    pageSettings.mapPlugin.addPolygon('App', {
			FillColor:		'#808080'
                        path:           outlineCoordinates
                    });
                }
             }, this);
        });
    }
</script>

ETEJRadar
Posts: 11
Joined: Fri Aug 10, 2018 11:13 am

Re: Draw a polygon on google maps with custom plugins

Post by ETEJRadar » Fri Feb 07, 2020 10:33 pm

I just found the error. I have to write paths instead of path

Post Reply