szewah
(Szewah Chin)
January 13, 2021, 6:58pm
#1
Hi,
I’ve been trying to add multiple data points as labels on a map layer. I’m using this tomtom tutorial as a guide.
Geographic Information System (GIS) data can come in a lot of forms, which can lead to confusion in how to represent data. One popular solution is GeoJSON, a data standard that was created by the Internet Engineering Task Force and defines a way to...
I’m trying one data point at first, writing it directly into the application.
const geoJSON = {
"type": "Point",
"geometry": {
"type": "Circle",
"coordinates": [
[-73.94928, 40.71114],
]
}
};
tomtomMap.on('load', () => {
tomtomMap.addLayer({
'id': 'overlay',
'type': 'circle',
'source': {
'type': 'geojson',
'data': {
'type': geoJSON["type"],
'geometry': geoJSON["geometry"],
}
},
'layout': {},
'paint': {
'circle-color': '#db356c',
}
});
})
However, I am seeing nothing and no error.
If I do a polygon fill, it works
Layers in a map are totally open to manipulation. In this article, we'll take a look at the mechanics of layers and how you can use features of the TomTom Maps SDKs and Map Display API to manipulate layers, add and remove layers, toggle layer...
But as a single POINT, it doesn’t. Please advise.
maloleps
(Przemek Malolepszy)
January 13, 2021, 8:43pm
#2
Do you want to have just a simple pixel drawn? Or a marker?
1 Like
szewah
(Szewah Chin)
January 13, 2021, 8:48pm
#3
It would be great to have a marker.
maloleps
(Przemek Malolepszy)
January 13, 2021, 9:51pm
#4
So this example should help you:
*/ /*-->*/ ...
1 Like
szewah
(Szewah Chin)
January 14, 2021, 1:42pm
#5
Thank you very much for this. I will try it out right now and let you know the results.
For Tom Tom’s reference, when I tried running the above code again, there was an error message of ‘Uncaught TypeError: Cannot read property ‘0’ of undefined’. The error was being caught by
mapbox-gl.js.
szewah
(Szewah Chin)
January 14, 2021, 8:22pm
#6
Hi,
Using this code, I am still unable to display the circles. I can show the markers however.
There are no errors.
szewah
(Szewah Chin)
January 15, 2021, 1:06pm
#7
I tried the Point again.
Instead of [‘data’][‘type’] = ‘Point’,
I used [‘data’][‘type’] = ‘Feature’.
Under [‘geometry’][‘type’], I used ‘Point’ instead of ‘Circle’.
It is now working