Hi,
Have been trying to work with MapkitJS for a website, but I'm stumped on once basic capability: I want to be able to click on a point of interest, and perform some actions such as:
Get its coordinates
Attach an annotation to it (e.g. a callout)
In my code, PointOfInterest's are selectable:
map.selectableMapFeatures = [
mapkit.MapFeatureType.PointOfInterest,
];
But when I click on one, I do see the marker pop up but nothing else (which is not much help since there is no additional information in the marker itself). I see no event getting triggered that I can do something with.
I am using an event listener as follows:
map.addEventListener('single-tap', (event) => {
const coordinate = map.convertPointOnPageToCoordinate(event.pointOnPage);
console.log('Map tapped at:', coordinate);
console.log('Map tapped event:', event);
...
I guess I have to grab the Place ID somehow but I don't know how to.
Thanks for any help.
Post
Replies
Boosts
Views
Activity
Hello,
I am building a web app using Mapkit JS, and have something up an running where I can add markers and annotate places with Place ID (I followed along with the WWDC24 video).
However occasionally, while I'm doing nothing on the browser, I get an runtime error with the following error trace (from developer tools in Chrome).
===
Uncaught TypeError: Cannot read properties of null (reading 'tint')
at get tint (mapkit.core.annotations.d43c86.js:2:97102)
at get colorScheme (mapkit.core.annotations.d43c86.js:2:81602)
at e.exports.PlaceCardController._renderPlaceIframe (mapkit.core.map.536988.js:2:214785)
at e.exports.PlaceCardController.update (mapkit.core.map.536988.js:2:212978)
at e.exports.PlaceCardController._handleConfigChanged (mapkit.core.map.536988.js:2:213284)
at _handleConfigChangedListener (mapkit.core.map.536988.js:2:212679)
at n.dispatchEvent (mapkit.core.js:2:16624)
at mapkit.core.js:2:10799
===
It is completely random, and not a result of any browser / Map interaction.
Seems to be an issue in mapkit.core, and related to Place IDs.
Can anyone help with this?