Would it be possible to implement the Google Maps API into Roblox?

I am talking about this: https://www.youtube.com/watch?v=QC51FEF0JeY

If anyone has any idea how this could be done, then feel free to reply! I feel as if this could be a cool feature for games to implement, but, I am fairly sure, the API is made with Unity in mind, so I’m not sure if it would be possible, but if it is then feel free to say so and how!

3 Likes

On my backlog I plan to use Google’s API to generate maps for real-life racetracks.

Nice! Have any idea on how I could implement it into Roblox? I’m fine with making a render distance system and stuff, but how would I actually get it into Roblox in the first place?

First step is setting up the API on google (you can just search for their APIs). Then you use the HttpService to pull in data. The hard part is interpreting that data and turning it into in-game stuff.

If you don’t have an understanding of HttpService, I would start there. Do some learning on HTTP requests first and understand how that works.

For instance, using the Elevation API, I can get the elevation in a range of locations or at a specific location:

Request:

https://maps.googleapis.com/maps/api/elevation/json?locations=0,0&key=MY_KEY

Response:

{
    "results": [
        {
            "elevation": -3492,
            "location": {
                "lat": 0,
                "lng": 0
            },
            "resolution": 610.8129272460938
        }
    ],
    "status": "OK"
}

Using the HttpService, you could translate that into a Lua table. Here’s bad code (since it does not have error handling), but demonstrates this:

local url = "https://maps.googleapis.com/maps/api/elevation/json?locations=0,0&key=MY_KEY"
local http = game:GetService("HttpService")
local rawData = http:GetAsync(url)
local data = http:JSONDecode(rawData)
print("Elevation:", data.results[1].elevation)
2 Likes

Thanks for the help! Do you know what API it is that allows you to create buildings and things though? I have been looking but can’t find it anywhere? Is it out yet?

I don’t know. Google’s API is massive and I honestly couldn’t find any helpful information after searching for like 10 minutes.

Okay, thanks anyways!

1 Like