fork download
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Place searches</title>
  5. <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
  6. <meta charset="utf-8">
  7. <style>
  8. /* Always set the map height explicitly to define the size of the div
  9. * element that contains the map. */
  10. #map {
  11. height: 100%;
  12. }
  13. /* Optional: Makes the sample page fill the window. */
  14. html, body {
  15. height: 100%;
  16. margin: 0;
  17. padding: 0;
  18. }
  19. </style>
  20. <script>
  21.  
  22. var map;
  23. var infowindow,mylat=null,mylng=null;
  24. function getLocation()
  25. {
  26. if (navigator.geolocation)
  27. {
  28. navigator.geolocation.getCurrentPosition(showPosition);
  29. }
  30. else
  31. alert("Geolocation is not supported by this browser.");
  32. }
  33. function showPosition(position) {
  34. mylat = position.coords.latitude;
  35. mylng = position.coords.longitude;
  36.  
  37. map.setCenter(new google.maps.LatLng(mylat, mylng));
  38. }
  39.  
  40. function initMap() {
  41. getLocation();
  42. console.log(mylat);
  43. console.log(mylng);
  44. var pyrmont = {lat: mylat, lng: mylng};
  45.  
  46. map = new google.maps.Map(document.getElementById('map'), {
  47. center: pyrmont,
  48. zoom: 15
  49. });
  50.  
  51. infowindow = new google.maps.InfoWindow();
  52. var service = new google.maps.places.PlacesService(map);
  53. service.nearbySearch({
  54. location: pyrmont,
  55. radius: 500,
  56. type: ['stores']
  57. }, callback);
  58. }
  59.  
  60. function callback(results, status) {
  61. if (status === google.maps.places.PlacesServiceStatus.OK) {
  62. for (var i = 0; i < results.length; i++) {
  63. console.log(results[i]);
  64.  
  65. createMarker(results[i]);
  66. }
  67. }
  68. }
  69.  
  70. function createMarker(place) {
  71. var placeLoc = place.geometry.location;
  72. var marker = new google.maps.Marker({
  73. map: map,
  74. position: place.geometry.location
  75. });
  76. var lat = marker.getPosition().lat();
  77. var lng = marker.getPosition().lng();
  78.  
  79. google.maps.event.addListener(marker, 'click', function() {
  80. //infowindow.setContent(place.name);
  81. console.log(place.geometry.location);
  82. content = "<div>"+"</div>"+"<div><img width='254' height='355' src='http://m...content-available-to-author-only...s.com/maps/api/streetview?size=640x480&location="+lat+","+lng+"&fov=120&heading=235&pitch=10&sensor=false'</div>" ;
  83. infowindow.setContent(content)
  84. infowindow.open(map, this);
  85. });
  86. }
  87. function createPhotoMarker(place) {
  88. var photos = place.photos;
  89. if (!photos) {
  90. }
  91.  
  92. var marker = new google.maps.Marker({
  93. map: map,
  94. position: place.geometry.location,
  95. title: place.name,
  96. icon: photos[0].getUrl({'maxWidth': 35, 'maxHeight': 35})
  97. });
  98. }
  99. </script>
  100. </head>
  101. <body>
  102. <div id="map">
  103.  
  104. </div>
  105. <script src="https://m...content-available-to-author-only...s.com/maps/api/js?key=AIzaSyCUgbqVR94dkpB7jKVLAWCl4ni3P0ESrJw&libraries=places&callback=initMap" async defer>
  106. </script>
  107. </body>
  108. </html>
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Traceback (most recent call last):
  File "/usr/lib/python3.5/py_compile.py", line 125, in compile
    _optimize=optimize)
  File "<frozen importlib._bootstrap_external>", line 735, in source_to_code
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "./prog.py", line 1
    <!DOCTYPE html>
    ^
SyntaxError: invalid syntax

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.5/py_compile.py", line 129, in compile
    raise py_exc
py_compile.PyCompileError:   File "./prog.py", line 1
    <!DOCTYPE html>
    ^
SyntaxError: invalid syntax

stdout
Standard output is empty