Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to display a single country in Google map? It should be only one country, not parts from other countries included

Tags:

google-maps

I need to display only a single country in google map. I need to display only one country and the parts of other countries should not be there.. for example if I want to display U.K. it should display only UK and sea around, no parts from other countries should be visible.

Is there a Google API call or any other method? I couldn't find a method than overriding zoom and overriding the methods they can navigate over the region (scrolling events).

Does anyone know a method to do this?

like image 469
Pasan Indeewara Avatar asked Jul 11 '10 02:07

Pasan Indeewara


People also ask

How do I show only one country on Google Maps?

we can allow only specific country to autocomplete search in google maps. We are using google map autocomplete for choosing address with latitude and longitude. but if you require to search only one country like in, us, uk etc then you can do it using setComponentRestrictions option in google map.

How do you create your own country on Google Maps?

Open Google Maps and click the menu button in the top left corner. Click Your Places > Maps > Create Map. Name your map and enter in a description. Add markers for your desired locations.

How do I filter a place on Google Maps?

Step 1 Go to Add/Manage Map -> Edit Page. Step 2 Assign those Locations using Choose Locations section, which you want to display on a google maps. Step 3 Scroll down to Custom Filters and insert placeholders like {country},{state},{city}. Insert Filter text according to it Filter placeholder.

Can you remove country names from Google Maps?

Open the Google Maps app and tap the Saved button at the bottom. Tap Labeled (or wherever you labels are saved) under Your lists . Tap the 3 dots next to the label you wish to remove and tap Remove (label name) .


1 Answers

If you disable all map elements and then a add new layer (a single country), then only one country is visible. Here is a jsfiddle https://jsfiddle.net/gvvy5vxz/2/

function initialize() {     var mapOptions = {     zoom: 5,     center: myLatlng,     mapTypeId: google.maps.MapTypeId.ROADMAP,     backgroundColor: '#FFF',     disableDefaultUI: true,     draggable: false,     scaleControl: false,     scrollwheel: false,     styles: [     {     "featureType": "water",     "elementType": "geometry",     "stylers": [       { "visibility": "off" }     ]     },{     "featureType": "landscape",     "stylers": [       { "visibility": "off" }     ]     },{     "featureType": "road",     "stylers": [       { "visibility": "off" }     ]     },{     "featureType": "administrative",     "stylers": [       { "visibility": "off" }     ]     },{     "featureType": "poi",     "stylers": [       { "visibility": "off" }     ]     },{     "featureType": "administrative",     "stylers": [       { "visibility": "off" }     ]     },{     "elementType": "labels",     "stylers": [       { "visibility": "off" }     ]     }   ] }; 

Example

like image 158
Mika Avatar answered Sep 18 '22 01:09

Mika