MapKit JS

RSS for tag

Embed interactive Apple maps on your website, annotate points of interest, and perform geo-related searches using MapKit JS.

Posts under MapKit JS tag

129 Posts

Post

Replies

Boosts

Views

Activity

display custom annotation per coordinate pulled from a locations.json file
We are working on an iOS-only travel app. The MapKit is a critical element of our design, and we have a few questions. We want to add custom icons on specific points on the map, for example: On 51.503301, -0.119564, add a custom icon of the London Eye Annotating/highlighting an area on a map, for example: Hydepark in London has a square, and we have 4 points on the map. We want to connect these points to form a square on the map with a custom colour.
0
0
1.3k
Aug ’22
Apple Maps API Question for my APP
Hi there, I was previousy using GOOGLE PLACES API for my new app. However the performance was really inconsistent. I would really like to use the Apple Maps API but want to make sure it will work for what I want it to do. Our app is designed to make deciding on where to eat eas and enjoyable for users. So we need users to see restaurants that are nearby, search restaurants and see their info (hours of operations, contact info, address) and save restaurants to their "favorites list". Is this doable with the Apple Maps API? And with how I want to use it would I be compliant? Thank you!
1
0
734
Aug ’22
Map Action URLs in Apple Maps Business Listings
Hello, As per the Map action url document https://register.apple.com/resources/bls/specification/map_action/map_action.html External Requirements for Providers MUST define the format of a Map Action URL and register their URL scheme with Apple In which place these url scheme and designated web end point information should be submitted to apple? Regards & Thanks
0
0
1.6k
Jul ’22
MapKit JS Autocomplete Example
Apple please provide example code to use MapKit JS Autocomplete. You are using MapKit JS Autocomplete on this site on the user profile page! Should be easy enough to take 5 minutes and cut and past the code into a response. Another time Apple showed MapKit JS Autocomplete was at WWDC2018, during this presentation: https://developer.apple.com/videos/play/wwdc2018/212/ But the example code they provided was incomplete.
3
0
1.4k
Jul ’22
Blank Satellite Map Tiles (using Mapkit JS)
There appears to be an issue with satellite map tile appearing as blank/black when using Mapkit JS on the web. See example from duckduckgo which uses Mapkit JS below (switch to satellite view to see blank tiles):- https://duckduckgo.com/?q=CH44+5UP&t=h_&ia=maps&iaxm=maps I have the same issue when using Mapkit JS. It is only a recent issue but appears widely across the UK (not sure of other countries). Does anyone know, how to raise this as an issue to the Apple Maps or Mapkit JS people (I can't seem to see a support email address or similar)? Thanks in advance.
2
1
1.3k
Jun ’22
Usability of 3D data
Hi, I was wondering what the possibilities are to use the 3D data accessible in Maps. I would like to analyze the building heights, and/or get the 3D visualization to be shown as an option in a JS app. Is it possible to retrieve building heights from Maps data, and what are the odds to visualize Maps 3D data in my own app? Bests Thomas
3
0
1.5k
May ’22
Custom Map annotations
Hello everyone, how can I change the standard pin icon to another? And how is it possible when I tap on the pin that an additional popup view opens in which the name of the city is at the top and that the associated image from the PhotoView is displayed? How could I best implement this? Thanks in advance MapView import MapKit import SwiftUI struct City: Identifiable {     let id = UUID()     let name: String     let coordinate: CLLocationCoordinate2D } struct MapView: View {     @State private var region = MKCoordinateRegion(center: CLLocationCoordinate2D(latitude: 46.62407, longitude: 8.03434), span: MKCoordinateSpan(latitudeDelta: 0.1, longitudeDelta: 0.1))          let annotations = [         City(name: "Alte Strasse(Zuhause)", coordinate: CLLocationCoordinate2D(latitude: 46.63649, longitude: 7.97512)),         City(name: "Stalden1", coordinate: CLLocationCoordinate2D(latitude: 46.63937, longitude: 7.97216)),         City(name: "Stalden2", coordinate: CLLocationCoordinate2D(latitude: 46.63873, longitude: 7.96684)),         City(name: "Scheideggstrasse(Wetterhorn)1", coordinate: CLLocationCoordinate2D(latitude: 46.63353, longitude: 8.07356)),         City(name: "Scheideggstrasse(Wetterhorn)2", coordinate: CLLocationCoordinate2D(latitude: 46.63293, longitude: 8.07380)),         City(name: "Scheideggstrasse(Wetterhorn)3", coordinate: CLLocationCoordinate2D(latitude: 46.63313, longitude: 8.07329)),         City(name: "Scheideggstrasse(Wetterhorn)4", coordinate: CLLocationCoordinate2D(latitude: 46.63456, longitude: 8.07337)),         City(name: "Obere Gletscherstrasse(Wetterhorn)", coordinate: CLLocationCoordinate2D(latitude: 46.63205, longitude: 8.07022)),         City(name: "Obere Gletscherstrasse(Hotel Blümlisalp)", coordinate: CLLocationCoordinate2D(latitude: 46.63173, longitude: 8.06699)),         City(name: "Itramenstrasse", coordinate: CLLocationCoordinate2D(latitude: 46.62060, longitude: 7.99514))     ]     var body: some View {         Map(coordinateRegion: $region, annotationItems: annotations) {             MapMarker(coordinate: $0.coordinate)             }         .onAppear {             MKMapView.appearance().mapType = .satellite         }             }     struct MapView_Previews: PreviewProvider {         static var previews: some View {             MapView()         }     } } PhotoView struct ContentView: View {     var images: [String] = ["noaa1", "noaa2", "noaa3", "noaa4", "noaa5", "noaa6", "noaa7", "noaa8", "noaa9", "noaa10", "noaa11", "noaa12", "noaa13", "noaa14", "noaa15", "noaa16", "noaa17", "noaa18"]          var columnGrid: [GridItem] = [GridItem(.fixed(180), spacing: 16), GridItem(.fixed(180), spacing: 16)]              var body: some View {         NavigationView {             ScrollView {                 LazyVGrid(columns: columnGrid, alignment: .center, spacing: 16) {                     ForEach(images, id: \.self) { image in                         NavigationLink (destination: ImageDetail(imageName: image)) {                             Image(image)                                 .resizable()                                 .scaledToFit()                                 .cornerRadius(10)                         }                     }                 }             }.navigationBarTitle(Text("Test"), displayMode: .inline)         }.navigationViewStyle(.stack)     } }
0
0
1.4k
May ’22
Disable auto focus (camera movement) when showing annotation on Mapkit JS
Hello, I would like to know if there is a way to disable the focus on a new added annotation on mapkit js. I have a loop that display annotation and every time the new annotation shows up, the map move the camera and set a super-dupper zoom on the new annotation. This is very annoying. Map initialisation : var map = new mapkit.Map("map", { region: region, showsCompass: mapkit.FeatureVisibility.Hidden, showsZoomControl: true, showsMapTypeControl: true, showsUserLocation: true, }); _ New annotation : chasseur = new mapkit.Coordinate(48.8607, 2.3421); ChasseurAnnotation = new mapkit.MarkerAnnotation(chasseur, { color: "#001788", title: "Chasseur", glyphText: "\u{1F6A8}" // POLICE }); map.showItems([ChasseurAnnotation]); _ Thanks a lot for your further responses.
2
0
1.2k
May ’22
500 Internal Errors for map "shield" resources
I've noticed a load of 500 errors in my web inspector when viewing maps - it's trying to load /md/v1/shield? from the CDN. Interestingly, it only seems to happen on UK and Ireland maps. Other countries don't even seem to try accessing these resources; but if you look at a map for UK or Ireland, then you will see dozens of failed requests for these shield resources. I don't think it's anything to do with my implementation, as I can replicate it when looking at one of Apple's example maps and repositioning to view the UK. Does anyone know why these shield resources are only used for the UK? And why they're not working?
1
0
876
Mar ’22
Wildcard subdomain
The documentation at https://developer.apple.com/documentation/mapkitjs/creating_and_using_tokens_with_mapkit_js states clearly that an asterisk can be used in the origin field of the MapKit JS Token to match multiple origin values. I quote: origin — An optional claim that constrains the token to a specific website or domain. The value of this claim is a fully qualified domain that matches the Origin header passed by a browser. Use the asterisk character (*) in the domain to match multiple origin values. Don’t include a trailing slash as part of the origin claim. So I created a token with an origin like https://*.mydomain.com and was very surprised (read: disappointed) when I deployed it and the authorization call towards Apple servers responded with this error: [MapKit] Initialization failed because the authorization token is invalid. Origin does not match - expected: https://*.mydomain.com, actual: https://www.mydomain.com Has anyone else had a similar issue, or success when using wildcard subdomains with MapKit JS Tokens?
3
0
1.8k
Mar ’22
MapKit JS: Searching in a region not working properly
Hi guys, I've created a search instance with MapKit JS, tried to look for all FoodMarkets in my region, passed the maps region (shown area) as argument but the search returns a lot of results not in my region, about 100km far away. That's my code: var search = new mapkit.Search({     getUserLocation: false,     region: Map.region,   });   search.search("Netto", function (error, data) {     if (error) {       // Handle search error       console.log("MAP ERROR: " + error);       return;     }     MapVisibleAnnotations = data.places.map(function (place) {       var annotation = new mapkit.MarkerAnnotation(place.coordinate);       annotation.title = place.name;       annotation.subtitle = place.formattedAddress;       annotation.color = "#9B6134";       return annotation;     });     Map.showItems(MapVisibleAnnotations);   }); What have I done wrong? It should only return all "netto" super markets in my region (about ~2km radius allowed) That's the desired search region: That's the result annotations, far far wider than it should be: When I change the search query from "Netto" to "Netto Straubing" (Straubing is the city name) -> it returns all "Netto" supermarkets nearby which is fine. But why doesn't it affect to the given region?
1
0
878
Feb ’22
UserLocation stops updating when map is touched
My issue is essentially the same described in MKUserLocation stops updating when map is touched, except for Mapkit JS. That question has been left without answer and the chat has been removed so I'm left wondering what the outcome was. In short, I create a Mapkit JS map, I set: map.tracksUserLocation = true; map.showsUserLocation = true; This shows and tracks the user's position on the map. Once I pan/zoom the map map.tracksUserLocation is set to false (as it should). However the user's dot stops updating entirely as well. I have ran some testing and it looks that if I initially only set map.showsUserLocation to true but don't specify wether the map should track the user's location, the user's dot will simply not show up at all. I can override this behaviour by constantly setting both variables to true, but as you can imagine the experience is awful. My code is essentially the bare basics. const map = new mapkit.Map('map'); map.tracksUserLocation = true; map.showsUserLocation = true; // ... <div id="map" /> I'm pretty sure this isn't supposed to happen, but it seems like a very obvious issue for it to be present for 5 years on both native and JS Mapkit libraries.
0
0
546
Feb ’22
update data Maps Connect via API?
is there a way to update data on Maps Connect via API?
Replies
0
Boosts
0
Views
1.3k
Activity
Aug ’22
Mapkit JS LookAround
Is there any way to get the Look Around option with JS?
Replies
0
Boosts
0
Views
862
Activity
Aug ’22
display custom annotation per coordinate pulled from a locations.json file
We are working on an iOS-only travel app. The MapKit is a critical element of our design, and we have a few questions. We want to add custom icons on specific points on the map, for example: On 51.503301, -0.119564, add a custom icon of the London Eye Annotating/highlighting an area on a map, for example: Hydepark in London has a square, and we have 4 points on the map. We want to connect these points to form a square on the map with a custom colour.
Replies
0
Boosts
0
Views
1.3k
Activity
Aug ’22
Apple Maps API Question for my APP
Hi there, I was previousy using GOOGLE PLACES API for my new app. However the performance was really inconsistent. I would really like to use the Apple Maps API but want to make sure it will work for what I want it to do. Our app is designed to make deciding on where to eat eas and enjoyable for users. So we need users to see restaurants that are nearby, search restaurants and see their info (hours of operations, contact info, address) and save restaurants to their "favorites list". Is this doable with the Apple Maps API? And with how I want to use it would I be compliant? Thank you!
Replies
1
Boosts
0
Views
734
Activity
Aug ’22
Map Action URLs in Apple Maps Business Listings
Hello, As per the Map action url document https://register.apple.com/resources/bls/specification/map_action/map_action.html External Requirements for Providers MUST define the format of a Map Action URL and register their URL scheme with Apple In which place these url scheme and designated web end point information should be submitted to apple? Regards & Thanks
Replies
0
Boosts
0
Views
1.6k
Activity
Jul ’22
WeatherKit Radar for MapKit
I'm so glad apple has created a web api for WeatherKit as I thought my personal Dark Sky app was done once they were acquired. I've been able to recreate all dark sky calls using weatherKit. However, radar has always been hard to acquire. Now there is WeatherKit and MapKit, are there plans for radar in weatherKit, mapKit?
Replies
2
Boosts
1
Views
1.3k
Activity
Jul ’22
MapKit JS Autocomplete Example
Apple please provide example code to use MapKit JS Autocomplete. You are using MapKit JS Autocomplete on this site on the user profile page! Should be easy enough to take 5 minutes and cut and past the code into a response. Another time Apple showed MapKit JS Autocomplete was at WWDC2018, during this presentation: https://developer.apple.com/videos/play/wwdc2018/212/ But the example code they provided was incomplete.
Replies
3
Boosts
0
Views
1.4k
Activity
Jul ’22
Blank Satellite Map Tiles (using Mapkit JS)
There appears to be an issue with satellite map tile appearing as blank/black when using Mapkit JS on the web. See example from duckduckgo which uses Mapkit JS below (switch to satellite view to see blank tiles):- https://duckduckgo.com/?q=CH44+5UP&t=h_&ia=maps&iaxm=maps I have the same issue when using Mapkit JS. It is only a recent issue but appears widely across the UK (not sure of other countries). Does anyone know, how to raise this as an issue to the Apple Maps or Mapkit JS people (I can't seem to see a support email address or similar)? Thanks in advance.
Replies
2
Boosts
1
Views
1.3k
Activity
Jun ’22
Cannot set tint of [object object] which has only a getter
Hey there, after updating my Ionic app from Angular 12 to 13, I am suddenly getting an error with Mapkit JS which entirely blocks using it. I tried the latest version of Mapkit JS with 5.72.67 but other versions result in the same issue: Cannot set tint of [object object] which has only a getter Thank you for any kind of advice, Manuel
Replies
3
Boosts
0
Views
973
Activity
May ’22
Usability of 3D data
Hi, I was wondering what the possibilities are to use the 3D data accessible in Maps. I would like to analyze the building heights, and/or get the 3D visualization to be shown as an option in a JS app. Is it possible to retrieve building heights from Maps data, and what are the odds to visualize Maps 3D data in my own app? Bests Thomas
Replies
3
Boosts
0
Views
1.5k
Activity
May ’22
Custom Map annotations
Hello everyone, how can I change the standard pin icon to another? And how is it possible when I tap on the pin that an additional popup view opens in which the name of the city is at the top and that the associated image from the PhotoView is displayed? How could I best implement this? Thanks in advance MapView import MapKit import SwiftUI struct City: Identifiable {     let id = UUID()     let name: String     let coordinate: CLLocationCoordinate2D } struct MapView: View {     @State private var region = MKCoordinateRegion(center: CLLocationCoordinate2D(latitude: 46.62407, longitude: 8.03434), span: MKCoordinateSpan(latitudeDelta: 0.1, longitudeDelta: 0.1))          let annotations = [         City(name: "Alte Strasse(Zuhause)", coordinate: CLLocationCoordinate2D(latitude: 46.63649, longitude: 7.97512)),         City(name: "Stalden1", coordinate: CLLocationCoordinate2D(latitude: 46.63937, longitude: 7.97216)),         City(name: "Stalden2", coordinate: CLLocationCoordinate2D(latitude: 46.63873, longitude: 7.96684)),         City(name: "Scheideggstrasse(Wetterhorn)1", coordinate: CLLocationCoordinate2D(latitude: 46.63353, longitude: 8.07356)),         City(name: "Scheideggstrasse(Wetterhorn)2", coordinate: CLLocationCoordinate2D(latitude: 46.63293, longitude: 8.07380)),         City(name: "Scheideggstrasse(Wetterhorn)3", coordinate: CLLocationCoordinate2D(latitude: 46.63313, longitude: 8.07329)),         City(name: "Scheideggstrasse(Wetterhorn)4", coordinate: CLLocationCoordinate2D(latitude: 46.63456, longitude: 8.07337)),         City(name: "Obere Gletscherstrasse(Wetterhorn)", coordinate: CLLocationCoordinate2D(latitude: 46.63205, longitude: 8.07022)),         City(name: "Obere Gletscherstrasse(Hotel Blümlisalp)", coordinate: CLLocationCoordinate2D(latitude: 46.63173, longitude: 8.06699)),         City(name: "Itramenstrasse", coordinate: CLLocationCoordinate2D(latitude: 46.62060, longitude: 7.99514))     ]     var body: some View {         Map(coordinateRegion: $region, annotationItems: annotations) {             MapMarker(coordinate: $0.coordinate)             }         .onAppear {             MKMapView.appearance().mapType = .satellite         }             }     struct MapView_Previews: PreviewProvider {         static var previews: some View {             MapView()         }     } } PhotoView struct ContentView: View {     var images: [String] = ["noaa1", "noaa2", "noaa3", "noaa4", "noaa5", "noaa6", "noaa7", "noaa8", "noaa9", "noaa10", "noaa11", "noaa12", "noaa13", "noaa14", "noaa15", "noaa16", "noaa17", "noaa18"]          var columnGrid: [GridItem] = [GridItem(.fixed(180), spacing: 16), GridItem(.fixed(180), spacing: 16)]              var body: some View {         NavigationView {             ScrollView {                 LazyVGrid(columns: columnGrid, alignment: .center, spacing: 16) {                     ForEach(images, id: \.self) { image in                         NavigationLink (destination: ImageDetail(imageName: image)) {                             Image(image)                                 .resizable()                                 .scaledToFit()                                 .cornerRadius(10)                         }                     }                 }             }.navigationBarTitle(Text("Test"), displayMode: .inline)         }.navigationViewStyle(.stack)     } }
Replies
0
Boosts
0
Views
1.4k
Activity
May ’22
Disable auto focus (camera movement) when showing annotation on Mapkit JS
Hello, I would like to know if there is a way to disable the focus on a new added annotation on mapkit js. I have a loop that display annotation and every time the new annotation shows up, the map move the camera and set a super-dupper zoom on the new annotation. This is very annoying. Map initialisation : var map = new mapkit.Map("map", { region: region, showsCompass: mapkit.FeatureVisibility.Hidden, showsZoomControl: true, showsMapTypeControl: true, showsUserLocation: true, }); _ New annotation : chasseur = new mapkit.Coordinate(48.8607, 2.3421); ChasseurAnnotation = new mapkit.MarkerAnnotation(chasseur, { color: "#001788", title: "Chasseur", glyphText: "\u{1F6A8}" // POLICE }); map.showItems([ChasseurAnnotation]); _ Thanks a lot for your further responses.
Replies
2
Boosts
0
Views
1.2k
Activity
May ’22
500 Internal Errors for map "shield" resources
I've noticed a load of 500 errors in my web inspector when viewing maps - it's trying to load /md/v1/shield? from the CDN. Interestingly, it only seems to happen on UK and Ireland maps. Other countries don't even seem to try accessing these resources; but if you look at a map for UK or Ireland, then you will see dozens of failed requests for these shield resources. I don't think it's anything to do with my implementation, as I can replicate it when looking at one of Apple's example maps and repositioning to view the UK. Does anyone know why these shield resources are only used for the UK? And why they're not working?
Replies
1
Boosts
0
Views
876
Activity
Mar ’22
Wildcard subdomain
The documentation at https://developer.apple.com/documentation/mapkitjs/creating_and_using_tokens_with_mapkit_js states clearly that an asterisk can be used in the origin field of the MapKit JS Token to match multiple origin values. I quote: origin — An optional claim that constrains the token to a specific website or domain. The value of this claim is a fully qualified domain that matches the Origin header passed by a browser. Use the asterisk character (*) in the domain to match multiple origin values. Don’t include a trailing slash as part of the origin claim. So I created a token with an origin like https://*.mydomain.com and was very surprised (read: disappointed) when I deployed it and the authorization call towards Apple servers responded with this error: [MapKit] Initialization failed because the authorization token is invalid. Origin does not match - expected: https://*.mydomain.com, actual: https://www.mydomain.com Has anyone else had a similar issue, or success when using wildcard subdomains with MapKit JS Tokens?
Replies
3
Boosts
0
Views
1.8k
Activity
Mar ’22
MapKit JS: Searching in a region not working properly
Hi guys, I've created a search instance with MapKit JS, tried to look for all FoodMarkets in my region, passed the maps region (shown area) as argument but the search returns a lot of results not in my region, about 100km far away. That's my code: var search = new mapkit.Search({     getUserLocation: false,     region: Map.region,   });   search.search("Netto", function (error, data) {     if (error) {       // Handle search error       console.log("MAP ERROR: " + error);       return;     }     MapVisibleAnnotations = data.places.map(function (place) {       var annotation = new mapkit.MarkerAnnotation(place.coordinate);       annotation.title = place.name;       annotation.subtitle = place.formattedAddress;       annotation.color = "#9B6134";       return annotation;     });     Map.showItems(MapVisibleAnnotations);   }); What have I done wrong? It should only return all "netto" super markets in my region (about ~2km radius allowed) That's the desired search region: That's the result annotations, far far wider than it should be: When I change the search query from "Netto" to "Netto Straubing" (Straubing is the city name) -> it returns all "Netto" supermarkets nearby which is fine. But why doesn't it affect to the given region?
Replies
1
Boosts
0
Views
878
Activity
Feb ’22
Map
I am currently trying to make a map. However, it says that the 'view' is not in scope. What does this mean and how can I fix this?
Replies
1
Boosts
0
Views
657
Activity
Feb ’22
Can I handle ends of mapkit js map renderings?
How can I handle the end of mapkit js map overlays/annotations rendering, when I use addOverlays/addAnnotations methods How can I handle the end of mapkit js image annotation rerendering, when I change the URL property
Replies
1
Boosts
0
Views
883
Activity
Feb ’22
Map Creation
I am currently trying to create a map. However a bunch of errors keep showing up. What I am doing wrong and how would I be able to fix this?
Replies
2
Boosts
0
Views
1.1k
Activity
Feb ’22
Open annotation callout on page load with mapkit-js
I'm using mapkit-js. How can I programmatically open an annotations custom callout when the page loads? I've seen examples for mapkit https://stackoverflow.com/questions/52368106/how-to-programmatically-set-the-selected-with-callout-state-for-a-mapkit-marke but nothing for mapkit-js
Replies
0
Boosts
0
Views
542
Activity
Feb ’22
UserLocation stops updating when map is touched
My issue is essentially the same described in MKUserLocation stops updating when map is touched, except for Mapkit JS. That question has been left without answer and the chat has been removed so I'm left wondering what the outcome was. In short, I create a Mapkit JS map, I set: map.tracksUserLocation = true; map.showsUserLocation = true; This shows and tracks the user's position on the map. Once I pan/zoom the map map.tracksUserLocation is set to false (as it should). However the user's dot stops updating entirely as well. I have ran some testing and it looks that if I initially only set map.showsUserLocation to true but don't specify wether the map should track the user's location, the user's dot will simply not show up at all. I can override this behaviour by constantly setting both variables to true, but as you can imagine the experience is awful. My code is essentially the bare basics. const map = new mapkit.Map('map'); map.tracksUserLocation = true; map.showsUserLocation = true; // ... <div id="map" /> I'm pretty sure this isn't supposed to happen, but it seems like a very obvious issue for it to be present for 5 years on both native and JS Mapkit libraries.
Replies
0
Boosts
0
Views
546
Activity
Feb ’22