Car Commutes are Getting Longer

During the height of the Covid epidemic a number of visualizations were created to show the drop in road traffic and public transit use. As people were forced to quarantine and work from home our roads and transit networks saw an observable fall in traffic.For example Buzzfeed teamed up with Mapbox to create a series of interactive mapped visualizations showing the reduction in road traffic in Maps Mania… more →
Posted in: Interactive Maps

Using Generative AI as Your Content Assistant

Last week I had the honor of presenting one at TheJam.dev. This was my first presentation on generative AI and I got to share what I thought was an interesting use case – helping with the writing process. Now to be clear, I don’t mean using GenAI to write blog posts, that would be a horrible idea. (IMO!) Instead, I looked at how it could help with some of the process. Let me back up a bit and give some background. I’ve been a fan of John Birmingham for many years now. He’s an author who writes in the military/sci-fi/etc genre and has some pretty fascinating ideas. I initially discovered him via his "Axis of Time" trilogy which dealt with the idea of a modern... more →
Posted in: JavaScript

Using AI to Age OSM Maps

The screenshot above, from the SynthMap Demo, shows a side-by-side view of an Open Street Map and an AI generated map of the same OSM data changed to look like a 19th Century era Ordnance Survey map. This Victorian cosplaying map (on the right) was developed by Zekun Li, of the University of Minnesota, who trained an AI to transform OpenStreetMap data into images that resemble the Maps Mania… more →
Posted in: Interactive Maps

Adding URL Parameters to an Interactive Map

It’s Saturday so I have decided to give myself a 30 minute break. Today I will only be spending ½ an hour on the One Hour AI Map Challenge. In these 30 minutes I want to create URL parameters for Meet in the Middle which will allow us to replace the Google Maps link for shared meeting points with a link back to our own map.Prompt No.1:how can i add url parameters to a leaflet.js map to show Maps Mania… more →
Posted in: Interactive Maps

Using Generative AI to Improve Image Filenames

Last night I had an interesting thought. Many times I work with images that have vague filenames. For example, screenshot_1_24_12_23.jpg. Given that there are many APIs out there that can look at an image and provide a summary, what if we could use that to provide a better file name based on the content of the image? Here’s what I was able to find. As always, I began by prototyping in Google AI Studio. I apologize for stating this in basically every post on the topic, but I really want to stress how useful that is for development. I used a very simple prompt: Write a one sentence short summary of this image. The sentence should be no more than five words. And then did a quick test: If... more →
Posted in: JavaScript

Fixing Cumulative Layout Shift Problems on DavidWalshBlog

Over 50 thousand developers visit DavidWalshBlog every month from around the world to learn JavaScript tricks and fix problems in their code. Unfortunately, some of them have a slow experience on the site. David tracks the performance of his Core Web Vitals and overall performance with Request Metrics. Recently, we noticed that his CLS performance score was trending pretty slow for both desktop and mobile users. Wait, what is CLS? Cumulative Layout Shift (CLS) is one of the Core Web Vital performance metrics. It doesn’t measure load time directly, instead it measures how much a page shifts while it is being loaded. You’ve definitely seen this and been annoyed by it. These shifts... more →
Posted in: JavaScript

Plasticine Earth

Google Arts & Culture has used AI to turn the world into colorful dough. In this game your task is to identify famous cultural monuments around the world while turning unformed blobs of plasticine into colorful 3d models of the very same monuments.Each game of Google Un-Dough starts with a 3D plasticine globe. To begin the game you just need to spin this globe and select the country whose Maps Mania… more →
Posted in: Interactive Maps

Extract a Number from a String with JavaScript

User input from HTML form fields is generally provided to JavaScript as a string. We’ve lived with that fact for decades but sometimes developers need to extract numbers from that string. There are multiple ways to get those numbers but let’s rely on regular expressions to extract those numbers! To employ a regular expression to get a number within a string, we can use \d+: const string = "x12345david"; const [match] = string.match(/(\d+)/); match; // 12345 Regular expressions are capable of really powerful operations within JavaScript; this practice is one of the easier operations. Converting the number using a Number() wrapper will give you the number as a Number type. The... more →
Posted in: JavaScript
1 28 29 30 31 32 193