Possibility to modify styling of MapContext instances

18 views
Skip to first unread message

elvin.d...@gmail.com

unread,
Dec 4, 2023, 6:22:16 AM12/4/23
to TopBraid Suite Users
Currently we seem to have little control of styling geographic objects that are also MapContext instances. For example using tbgeo:text to display a label of the item on the map. Can we control things like CSS styling? Color, font. alignment etc?
The documentation doesn’t mention it so I guess not, but on darker map areas the default black rendering is very hard to read so I’d like to have some more fine grained control over styling these things.
Scherm­afbeelding 2023-12-04 om 12.16.26.pngScherm­afbeelding 2023-12-04 om 12.20.31.png

Holger Knublauch

unread,
Dec 4, 2023, 6:51:38 AM12/4/23
to 'Bohms, H.M. (Michel)' via TopBraid Suite Users
Hi Elvin,

I am not aware that this is even possible in the Google Maps API. FWIW our code does this

markerItems.map((item) => {
let marker = this.markers[item.uri];
if(!marker) {
marker = new google.maps.Marker({
map: this.map,
})
marker.addListener('click', () => this.onClick(item))
this.markers[item.uri] = marker;
}
marker.setIcon(this.getMarkerIcon(item));
marker.setLabel(this.getMarkerLabel(item));
marker.setPosition({ lat: item.lat, lng: item.long});
marker.setTitle(sanitizeHTMLOnlyBTags(item.label));
usedMarkers[item.uri] = true;
})
for(let itemURI in this.markers) {
if(!usedMarkers[itemURI]) {
let marker = this.markers[itemURI];
marker.setMap(null);
delete this.markers[itemURI];
}
}

I guess the intention is that the marker labels are just short texts that appear on top of the icon, and thus have predictable background.

Given that you don't really know what the background would be I don't know how you would choose a suitable color. For example if you make it white, how would it know that the background isn't white at this place on the map.

Holger


On 4 Dec 2023, at 12:22 pm, elvin.d...@gmail.com <elvin.d...@gmail.com> wrote:

Currently we seem to have little control of styling geographic objects that are also MapContext instances. For example using tbgeo:text to display a label of the item on the map. Can we control things like CSS styling? Color, font. alignment etc?
The documentation doesn’t mention it so I guess not, but on darker map areas the default black rendering is very hard to read so I’d like to have some more fine grained control over styling these things.
<Scherm­afbeelding 2023-12-04 om 12.16.26.png><Scherm­afbeelding 2023-12-04 om 12.20.31.png>


--
The topics of this mailing list include TopBraid EDG and related technologies such as SHACL.
To post to this group, send email to topbrai...@googlegroups.com
---
You received this message because you are subscribed to the Google Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to topbraid-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/47acfbfb-5abc-463b-a53e-53d6b68c0168n%40googlegroups.com.
<Scherm­afbeelding 2023-12-04 om 12.20.31.png><Scherm­afbeelding 2023-12-04 om 12.16.26.png>

Reply all
Reply to author
Forward
0 new messages