Setting the style to a map with Angular
See original GitHub issueWhen loading the map and setting the zoom, it seems the map is missing a lot of the details shown in the web version, as it is only showing any additional detail.
With the latest styling commit to the repo, I tried changing the styling and adding more detail to the map to match the default web version as closely as possible - however, I am getting the same output with no details.
This is what I currently have:
page.component.ts
onMapReady = (args) => {
var mapsModule = require("nativescript-google-maps-sdk");
var style = require("./map-style.json");
this.mapView = args.object;
this.mapView.latitude = 8.5125665;
this.mapView.longitude = -81.3038948;
this.mapView.zoom = 20;
//change map styling
this.mapView.setStyle( style );
//this.mapView.setStyle( JSON.stringify(style) ); //tried this as well
//this.mapView.gMap.setStyle( JSON.stringify(style) ); //tried this as well
var marker = new mapsModule.Marker();
marker.position = mapsModule.Position.positionFromLatLng(28.3818941,-81.5768487);
this.mapView.addMarker(marker);
};
page.html
<GridLayout>
<MapView (mapReady)="onMapReady($event)"></MapView>
</GridLayout>
map-style.json
[
{
"elementType": "geometry",
"stylers": [
{
"color": "#212121"
}
]
},
{
"elementType": "labels.icon",
"stylers": [
{
"visibility": "off"
}
]
},
{
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#757575"
}
]
},
{
"elementType": "labels.text.stroke",
"stylers": [
{
"color": "#212121"
}
]
},
{
"featureType": "administrative",
"elementType": "geometry",
"stylers": [
{
"color": "#757575"
}
]
},
{
"featureType": "administrative.country",
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#9e9e9e"
}
]
},
{
"featureType": "administrative.land_parcel",
"stylers": [
{
"visibility": "off"
}
]
},
{
"featureType": "administrative.locality",
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#bdbdbd"
}
]
},
{
"featureType": "poi",
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#757575"
}
]
},
{
"featureType": "poi.park",
"elementType": "geometry",
"stylers": [
{
"color": "#181818"
}
]
},
{
"featureType": "poi.park",
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#616161"
}
]
},
{
"featureType": "poi.park",
"elementType": "labels.text.stroke",
"stylers": [
{
"color": "#1b1b1b"
}
]
},
{
"featureType": "road",
"elementType": "geometry.fill",
"stylers": [
{
"color": "#2c2c2c"
}
]
},
{
"featureType": "road",
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#8a8a8a"
}
]
},
{
"featureType": "road.arterial",
"elementType": "geometry",
"stylers": [
{
"color": "#373737"
}
]
},
{
"featureType": "road.highway",
"elementType": "geometry",
"stylers": [
{
"color": "#3c3c3c"
}
]
},
{
"featureType": "road.highway.controlled_access",
"elementType": "geometry",
"stylers": [
{
"color": "#4e4e4e"
}
]
},
{
"featureType": "road.local",
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#616161"
}
]
},
{
"featureType": "transit",
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#757575"
}
]
},
{
"featureType": "water",
"elementType": "geometry",
"stylers": [
{
"color": "#000000"
}
]
},
{
"featureType": "water",
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#3d3d3d"
}
]
}
]
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:9 (1 by maintainers)
Top Results From Across the Web
Google map styling - Medium
Styling Map : after integrating map you can style map by the following process: go to link: https://mapstyle.withgoogle.com/ and style your map ......
Read more >Angular 11 - google-maps Switch Map Style - Stack Overflow
I solved it by using @ViewChild(GoogleMap, { static: false }) map: GoogleMap. And ngOnChanges() { this.change(this.isLight); } change(input) ...
Read more >Styled Map Selection | Maps JavaScript API
This example applies custom styles to a map by setting MapOptions.styles to a JSON object ... Set the map's style to the initial...
Read more >Component styles - Angular
One way to do this is to set the styles property in the component metadata. The styles property takes an array of strings...
Read more >How to display a map in Angular using MapLibre GL JS
Create a map component · The container option sets the DOM element in which the map will be rendered. · The style option...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
In Android, I was able to edit the styles:
mapstyle.ts:
component.ts:
Will try to post iOS version if I get it to work
iOS version :
mapstyle.ts:
component.ts: