Mehmet Edebali Şener
Posts: 0
Joined: Thu May 30, 2013 7:33 pm

Removing Google Map elements and gestures from the screen

Hello,

I want to remove Google Map elements and gestures such as incresing/decreasing zoom level button, changing street view to satellite and sliding the map etc. from my app screen

disableDefaultUI : true,
disableDoubleClickZoom : true,
draggable : false,
keyboardShortcuts : false,
mapTypeControl : false,
mapMaker : false,
overviewMapControl : false,
panControl : false,
rotateControl : false,
scaleControl : false,
scrollwheel : false,
streetViewControl : false,
zoomControl : false,

The options above are the options that I want to use in my application. I both tried to change the options from the original js and creating new map with these options but I couldn't succeeded.

Thanks in advance

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Removing Google Map elements and gestures from the screen

Please check and refer to Google Maps API how to do this. Appery.io uses the standard Google Maps component.

Mehmet Edebali Şener
Posts: 0
Joined: Thu May 30, 2013 7:33 pm

Removing Google Map elements and gestures from the screen

pre<code>
<!DOCTYPE html>
<html>
<head>
<script
src="http:&#47;&#47;maps&#46;googleapis&#46;com&#47;maps&#47;api&#47;js?key=AIzaSyDY0kkJiTPVd2U7aTOAwhc9ySH6oHxOIYM&sensor=false">
<&#47;script>

<script>
var myCenter=new google&#46;maps&#46;LatLng(51&#46;508742,-0&#46;120850);

function initialize()
{
var mapProp = {
center: myCenter,
zoom:5,
showLocationMarker : false,
disableDefaultUI : true,
disableDoubleClickZoom : true,
draggable : false,
keyboardShortcuts : false,
mapTypeControl : false,
mapMaker : false,
overviewMapControl : false,
panControl : false,
rotateControl : false,
scaleControl : false,
scrollwheel : false,
streetViewControl : false,
zoomControl : false,
mapTypeId: google&#46;maps&#46;MapTypeId&#46;ROADMAP
};

var map = new google&#46;maps&#46;Map(document&#46;getElementById("googleMap"),mapProp);

}
google&#46;maps&#46;event&#46;addDomListener(window, 'load', initialize);
<&#47;script>
<&#47;head>

<body>
<div id="googleMap" style="width:500px;height:380px;"><&#47;div>

<&#47;body>
<&#47;html>
/pre

for example this is orginal html code with options. It works normaly, however when i use this options in appery it doesn't work.

I also tried map.setOptions metod after instantiating map. it doesn't work either.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Removing Google Map elements and gestures from the screen

Hello! Sorry for delay. Could you clarify please where did you add this code and what exactly doesn't work?

Mehmet Edebali Şener
Posts: 0
Joined: Thu May 30, 2013 7:33 pm

Removing Google Map elements and gestures from the screen

I want to remove Google Map UI elements and gestures. I just need users' current place as an image. User must not zoom_in, zoom_out or drag map etc.

I try two diffrent things :

1) editing source html (mainPage.html in my project) with new google map options like :

pre<code>
$("[name = 'map']")&#46;wrap("<div&#47;>");
$("[name = 'map']")&#46;parent()&#46;css("margin-left", $("[name = 'map']")&#46;css("margin-left"));
$("[name = 'map']")&#46;parent()&#46;css("margin-right", $("[name = 'map']")&#46;css("margin-right"));
$("[name = 'map']")&#46;css("margin-left", '0');
$("[name = 'map']")&#46;css("margin-right", '0');

Code: Select all

     var map_options = { 
         markerSourceName: "map_markers", 
         latitude: "", 
         longitude: "", 
         address: "", 
         zoom: 20, 
         showLocationMarker: false, 
         disableDefaultUI : true, 
      disableDoubleClickZoom : true, 
         draggable : false, 
         keyboardShortcuts : false, 
         mapTypeControl : false, 
         mapMaker : false, 
         overviewMapControl : false, 
         panControl : false, 
         rotateControl : false, 
         scaleControl : false, 
         scrollwheel : false, 
         streetViewControl : false, 
         zoomControl : false, 
  mapTypeId: google&#46;maps&#46;MapTypeId&#46;ROADMAP 
     } 

     Appery&#46;__registerComponent('map', new Appery&#46;TiggziMapComponent("map", map_options)); 
     $("[name='map_markers'] [apperytype='marker']")&#46;attr("reRender", "map"); 
     $("[name='map']")&#46;closest("[data-role='page']")&#46;bind({ 
         pageshow: function() { 
             if (Appery('map') != undefined) { 
                 Appery('map')&#46;refresh(); 
             } 
         } 
     }); 

/pre

2) adding buton and click event js like:

pre<code>

var map = Appery('map');
map&#46;setOptions({ disableDefaultUI : true, disableDoubleClickZoom : true, draggable : false, keyboardShortcuts : false, mapTypeControl : false, mapMaker : false, overviewMapControl : false, panControl : false, rotateControl : false, scaleControl : false, scrollwheel : false, streetViewControl : false, zoomControl : false, });
map&#46;refresh();

/pre

Both of these failed. Google map UI buttons can be removed. Gestures still working; zooming map.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Removing Google Map elements and gestures from the screen

HI, perhaps it's better to use Static Maps. Please take a look here https://developers.google.com/maps/do... and let us know result. If you still have any questions we'll try to help.

Return to “Issues”