How would I make every city on Earth as a part on roblox?


my goal:

#1 how can I get this data from a website

#2 how can I Convert the lat and long into a 3d position on a ball

1 Like

mb i didnt delete all the text

There’s not many great databases on this topic for free. I did manage to find one with around 150K though. Geonames - All Cities with a population > 1000 — Opendatasoft
EDIT: I’ll put this file on one of my old sites later to make it easier for you

As for plotting them on a ball-

local PointOnSphere = function(Center:Vector3, Radius:number, lat, lon)	  
	-- convert coords to radians
	lat = math.rad(lat);
	lon = math.rad(lon);
	-- calc position
	local x = (Radius) * math.cos(lat) * math.cos(lon);   
	local y = (Radius) * math.cos(lat) * math.sin(lon);
	local z = (Radius) * math.sin(lat);
	-- return pos
	return (Center + Vector3.new(x, y, z)); 
end;

-- EXAMPLE: 
local sphereCenter = Vector3.zero; -- center of the ball
local radius = 50; -- radius of the ball (half the width)  
-- lon and lat, for example las vegas is located at these coords below.
local latitude = 36.17497; 
local longitude = -115.13722; 

-- create a part
local part = Instance.new("Part", workspace);
part.Anchored = true;
part.Size = Vector3.one;
part.Position = PointOnSphere(sphereCenter, radius, latitude, longitude);

For the second task the following equations should help:

--The inputs of math.rad are in degrees
local lat, long = math.rad(0), math.rad(0)
local R = math.min(sphere.Size.X, sphere.Size.Y, sphere.Size.Z)/2

local x = math.cos(lat)*math.cos(long)
local y = math.cos(lat)*math.sin(long)
local z = math.sin(lat)

local pos = R*Vector3.new(x, y, z)+sphere.Position --maybe /2 is needed for position
print(pos.X, pos.Y, pos.Z)

https://rd.floobfloob.com/geonames-all-cities-with-a-population-1000.json
Here is the file (86MB) of 150k towns/cities. @v287_1
Note that itll be deleted in around 5 days, so back it up somewhere if you need it.

game.HttpService:JSONDecode(game.HttpService:GetAsync('https://rd.floobfloob.com/geonames-all-cities-with-a-population-1000.json'))

Not guaranteed that this’ll work- it is 86mb after all…
and whatever you do, DO NOT PRINT THIS TO THE OUTPUT.