I'm trying to visualize data by mapping the latitude, longitude, and magnitude of some major Chicago neighborhoods with p5.js. It's inspired by this coding challenge. I followed it thoroughly, only changed the area and zoom of the map (using Mapbox API). The codes look right, and the map shows up. But when I try to visualize just one single location as a circle on the map before even inputting the data, it doesn't show up on the sketch. Super grateful if anyone can let me know what might be the problem here!
var mapimg;
var zoom = 10;
var clat = 0;
var clon = 0;
var lat = 41.9000;
var lon = -87.7204;
function preload() {
mapimg = loadImage ('https://api.mapbox.com/styles/v1/mapbox/dark-v10/static/-87.7278,41.9099,10,0/400x400?access_token=pk.eyJ1Ijoic2wzMDcyNCIsImEiOiJja3VuMWNieWgzd3MzMnVrNmU2bzNwdndoIn0.cGgvcAgQwVdnNsHLIeBf9A');
}
function mercX(lon) {
lon = radians(lon);
var a = (256 / PI) * pow(2, zoom);
var b = (lon) + PI;
return a * b;
}
function mercY (lat) {
lat = radians(lat);
var a = (256 / PI) * pow(2, zoom);
var b = tan(PI / 4 + lat / 2);
var c = PI - log(b);
return a * c;
}
function setup() {
createCanvas(400, 400);
translate(width/2, height/2);
imageMode(CENTER);
image(mapimg, 0, 0);
stroke(255);
strokeWeight(100);
noFill();
circle(0, 0, 500);
var cx = mercX(clon);
var cy = mercY(clat);
var x = mercX(lon) - cx;
var y = mercY(lat) - cy;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.4.0/p5.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.4.0/addons/p5.sound.min.js"></script>