Thanks to visit codestin.com
Credit goes to github.com

Skip to content

GoogleMapPlotter.get

frslm edited this page Jun 26, 2020 · 6 revisions

GoogleMapPlotter.get()


Return the HTML map as a string.

  • Returns

    str – HTML map.

Usage:

import gmplot
apikey = '' # (your API key here)
gmap = gmplot.GoogleMapPlotter(37.766956, -122.438481, 13, apikey=apikey)
print(gmap.get())
-> <html>
   <head>
   <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
   <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
   <title>Google Maps - gmplot</title>
   <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?libraries=visualization"></script>
   <script type="text/javascript">
       function initialize() {
           var map = new google.maps.Map(document.getElementById("map_canvas"), {
               zoom: 13,
               center: new google.maps.LatLng(37.766956, -122.438481)
           });

       }
   </script>
   </head>
   <body style="margin:0px; padding:0px;" onload="initialize()">
       <div id="map_canvas" style="width: 100%; height: 100%;" />
   </body>
   </html>

Clone this wiki locally