Apple Maps Server API

RSS for tag

Increase performance, lower data usage, and improve battery life across platforms for a variety of Apple Maps features.

Posts under Apple Maps Server API tag

14 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

How to correct business location?
My organization, Los Angeles Pierce College, rents space to "Topanga Vintage Market", which is a monthly weekend swap meet operation. Apple Maps shows the location as roughly 34.18715° N, 118.58058° W. However, this is the location of the campus Child Development Center, which provides child care services and is not open during the hours of the Topanga Vintage Market. The actual location should be in the adjacent large parking lot, roughly 34.18740° N, 118.57782° W. They do not have a physical building. How do I get this resolved? I am putting a campus mapping application into the App Store real soon now. There is also an entry for "ALC Taco Truck" about 34.18533° N, 118.57349° W, which as far as I know has not been on campus since Covid. Thanks in advance for any guidance you can provide.
1
0
146
1w
How the duck can I use .p8 to get the Mapkit Server API token to use it without 7 day duration?
https://developer.apple.com/documentation/applemapsserverapi/creating-and-using-tokens-with-maps-server-api This doesn't really say what to do with .p8 private key. I know I am a noob but I really don't understand Apple Doc at all. There is no example or anything like that. const appleMapKit = await fetch("https://maps-api.apple.com/v1/token", { headers: { Authorization: `Bearer ${server_api_token}`, }, }); This is what I did but because I created the token on website, server_api_token only lasts 7 days. So, I tried to use Profile - Key to replace that. I have .p8 file and how can I use this to create the token for the server api?
1
0
298
Nov ’24
Apple Maps Server API Unauthorized Error
I'm trying to use the new Apple Maps Server API. As far as I can tell I have set up the token correctly, but my web request is still returning 401 unauthorized. The following is my code in TypeScript: import * as jwt from 'jsonwebtoken'; const JWT_SECRET = "-----BEGIN PRIVATE KEY-----\n" + "MIGTAgEAMBMGBy..............................\n" + "..............................................................\n" + "..............................................................\n" + "-----END PRIVATE KEY-----"; const header = { alg: "ES256", kid: "26DYPK65ZK", typ: "jwt" } // Example payload data const payload = { "iss": "7F3PBYWYMS", "iat": Date.now(), "exp": Date.now() + (1000 * 30 * 60), }; export async function getRestaurants() { let token = jwt.sign(payload, JWT_SECRET, { algorithm: 'ES256', header: header}); const response = await fetch('https://maps-api.apple.com/v1/token (https://maps-api.apple.com/v1/token)', { method: 'GET', headers: { 'Authorization': "Bearer " + token }, }); console.log(response); } What am I doing incorrectly here?
7
0
430
Nov ’24
Did the Snapshot API authentication change too?
Previously (and still, according to the documentation) building a Map Snapshot URL required building the URL with all its parameters, and then signing it using your private key. However, the URL created via the "Create a map" tool simply appends the pre-generated token on the end of the URL. And if I build a URL and do the same thing - append the token, but do not create a signature - the snapshot is generated correctly. (Omitting the token leads to a "not authenticated" message). Is this a new, easier way to generate snapshots?
1
1
567
Jun ’24
Multi Polygons MapKit
Is MultiPolygon overlay support going to be integrated with SwiftUI? I have made a post on here previously without a reply :( Any suggestions on how to display multi-polygons within MapKit for SwiftUI(https://developer.apple.com/documentation/mapkit/mappolygon)? At the moment it is not supported and only supported by MapKit for UIKit(https://developer.apple.com/documentation/mapkit/mkmultipolygon).
4
1
867
Nov ’24
Apple Maps Server API invalid JWT token
Hello, I'm truing to use Maps Server API. I have: Created Maps Identifier and a Private Key Used token maker to create a JWT token. I also tried creating JWT token manually. After generating a JWT token I used Maps Server API Playground with my JWT and I can successfully use Maps Server API. The problem is that when I try to use my JWT in either JS code, Postman or curl request, I get "Invalid Token" error. Which is very strange, because I doubled checked everything dozen of times and JWT works in Apple's playground tool. Here's a request example: curl -si -H"Authorization: Bearer <jwt token>" "https://maps-api.apple.com/v1/geocode?q=Apple%20Park%2C%20Cupertino%2C%20CA" My token is valid for 1 year When generating JWT token I left "Domain restriction" field empty.
1
1
919
Jun ’24
API Authentication
I am trying to migrate some of my mapkit code to the Map Server API. My JWT is fine and I can use that within the API Playground just fine. However, when I try to implement a test using PHP and cURL to get my Map token, I receive a 401 Not Authorized Error. My code is below: <?php $URL="https://maps-api.apple.com/v1/token"; $accesstoken = "<MY TOKEN HERE>"; $authorization = 'Authorization: Bearer'.$accesstoken; $headers = []; $ch = curl_init($URL); curl_setopt($ch, CURLOPT_HTTPHEADER, [$authorization]); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_HEADERFUNCTION, function($curl, $header) use (&$headers) { $len = strlen($header); $header = explode(':', $header, 2); if (count($header) < 2) // ignore invalid headers return $len; $headers[strtolower(trim($header[0]))][] = trim($header[1]); return $len; } ); $result=curl_exec($ch); $status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); //get status code curl_close ($ch); print_r($headers); echo($result); echo($status_code); ?> Now the exact response that I am receiving is: Array ( [date] => Array ( [0] => Thu, 18 Apr 2024 18:32:15 GMT ) [content-type] => Array ( [0] => application/json;charset=utf8 ) [content-length] => Array ( [0] => 51 ) [connection] => Array ( [0] => keep-alive ) [cache-control] => Array ( [0] => max-age=0 ) [x-rid] => Array ( [0] => c9507281-bc32-46ac-be3b-dc59e97e7fed ) [strict-transport-security] => Array ( [0] => max-age=31536000; includeSubDomains; ) ) {"error":{"message":"Not Authorized","details":[]}} 401 Any help getting this to work would be appreciated.
1
0
688
Apr ’24
MapKit - Route Drawn and MkStep Direction
I am making an app like Taxi Driving, where users can add location and driver to that location. The problems I am facing are below: Drawing a route on MKMap - I get the route polyline and I render that on the map. Now what should happen as I am driving, the drove part of the polyline should get removed or may be turned grey, non-drove part should be blue. Currently, I am only able to do this by again getting a route from my current location and re-drawing on the map which is not a good thing I suppose. Show driving instructions - I need to show step-by-step instructions which I get in the MKStep under the MKRoute object. But I don't get the icons that I can show such as Turn Right or Turn left the only thing I have is plain text. I need an icon along with it and also how to identify once I have crossed the step and show the next step as my next instruction. These two are the major problems I am facing and I need to do this with Apple native map view itself so no third-party integration I want.
0
1
724
Feb ’24