MapKit JS

RSS for tag

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

MapKit JS Documentation

Pinned Posts

Posts under MapKit JS tag

27 Posts
Sort by:
Post not yet marked as solved
0 Replies
76 Views
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
Posted
by paras.
Last updated
.
Post not yet marked as solved
2 Replies
163 Views
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?
Posted Last updated
.
Post not yet marked as solved
3 Replies
103 Views
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.
Posted Last updated
.
Post not yet marked as solved
2 Replies
262 Views
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.
Posted
by gazzatb.
Last updated
.
Post not yet marked as solved
3 Replies
205 Views
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
Posted Last updated
.
Post marked as solved
3 Replies
205 Views
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
Posted
by TomGeoDK.
Last updated
.
Post not yet marked as solved
0 Replies
212 Views
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)     } }
Posted
by iRIG.
Last updated
.
Post marked as solved
2 Replies
227 Views
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.
Posted Last updated
.
Post not yet marked as solved
0 Replies
159 Views
Hello! MapKit JS sample code is now available at https://maps.developer.apple.com/sample-code. Here's a list of the samples that are currently available: Embedded Map Demonstrates simply displaying a map with minimal code. Annotations & Reverse Geocoding Demonstrates adding/removing annotations, using the Reverse Geocoding API to find place data. Annotations with a Custom Callout Demonstrates how to add custom styles to annotation callouts. US Population By State Overlays Demonstrates displaying, transforming, and interacting with GeoJSON-based map overlays. Callout Accessory Views Demonstrates displaying additional customized elements within a callout. Region and Zoom Limits Demonstrates limiting a map's viewport's zoom levels and latitude/longitude constraints. Animated Polyline Overlays Demonstrates animating an overlay property in a request animation frame loop.
Posted
by Frameworks Engineer.
Last updated
.
Post not yet marked as solved
1 Replies
199 Views
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?
Posted
by sebduggan.
Last updated
.
Post not yet marked as solved
3 Replies
528 Views
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?
Posted
by Agos.
Last updated
.
Post marked as solved
1 Replies
242 Views
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?
Posted Last updated
.
Post not yet marked as solved
0 Replies
197 Views
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?
Posted Last updated
.
Post not yet marked as solved
1 Replies
204 Views
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
Posted Last updated
.
Post not yet marked as solved
2 Replies
351 Views
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?
Posted Last updated
.
Post not yet marked as solved
0 Replies
223 Views
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
Posted Last updated
.
Post not yet marked as solved
0 Replies
193 Views
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.
Posted
by lpetrucci.
Last updated
.
Post not yet marked as solved
1 Replies
561 Views
Hello 👋🏼, We are using MapKit JS to display maps on our application working on two domains .com and .cn. Everything is working for all ours users in the world except for users using Chinese local network. After investigation, there is an error display in the browser console: [MapKit] Initialization failed because the authorization token is invalid. As the tokens are used as they are for the rest of the world, we know that they are valid... 😕 Problem appears on all browsers: Current versions of MapKit JS mapkit-typescript @ 5.18.2 https://cdn.apple-mapkit.com/mk/5.49.x/mapkit.js Do you have any tips, suggestions to help us 🙏 ? Aurélien.
Posted Last updated
.
Post not yet marked as solved
0 Replies
233 Views
On iOS, we could get the 'subAdministrativeArea' in CLPlacemark when doing a reverse geocode via MapKit, which, in the US, gives us the county name. How do we get the equivalent county name when using MapKit JS? The Place object that is returned doesn't have a subAdministrativeArea and doesn't seem to have any other property for county name?
Posted
by eimanz11.
Last updated
.
Post not yet marked as solved
0 Replies
293 Views
Is anybody who can help to correct the name of the street Grant Vardanyan in English language on the Apple map? The street is situated in Masis town, Armenia. Latitude 40.0634, Longitude 44.3389.The postal code is 0802. The first name of the street is Hrant not Grant. The first letter of the first name is (H), and not (G). There is a misspelling. Right spelling is Hrant with (H), not with (G) Grant. Link in Map (https://maps.apple.com/place?address=Grant%20Vardanyan%20street%2C%20Armenia&ll=40.064079%2C44.398792&q=Marked%20Location&_ext=EiYpvnTXN5sHREAxpznU%2FUoyRkA5PEr9k8EIREBB%2FWeFnMszRkBQBA%3D%3D&t=m&fbclid=IwAR3S2kvGn6yxIA3MM8duRmQ_4BCUIuAtqLl175jO0WbwHym0dVxod0DErzI  I also want to share with you other maps links where the Hrant Vardanyan street (in Masis town) is written (spelled) correctly. Maybe these links will help the internal team to work on our issue. See the attached links:  Google map - https://www.google.com/maps/place/Hrant+Vardanyan+St,+Masis+0802/@40.064176,44.4112118,16.75z/data=!4m5!3m4!1s0x406ac6e0419443ef:0x95a313071e008374!8m2!3d40.063254!4d44.4112632?hl=en 2.Yandex map - https://yandex.com/maps/116121/masis/geo/3750522170/?ll=44.414126%2C40.064158&z=15.98
Posted
by Astghik.
Last updated
.