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?
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.
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.
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.
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) .
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" } ] } ] };
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With