Tag Archives: Google Maps

A Javascript learning project — Google Maps

Starting out with the goal of deepening my knowledge of Javascript, I decided to create a page which displays a Google Map of the United States and allows the user to view outlines of every county. Taking the idea a step further, the user can also display a filled-in version of each county, with the darkness of the fill determined by setting a percentage value. Such functionality produces a map which makes it easy to visualize statistical data.

I am likely to separate this post into its own page, depending on how much time I devote to extending my project into a teaching opportunity. Until that (maybe) happens, here are some bullet points which might be of interest. Please post questions or comments if you are so inclined.

1) The page takes a minute to load initially. There is a ton of data associated with drawing the county polygons. As long as the JS files are cached locally, subsequent page load times will be short.

2) You can view the JS code to see what I did and to get ideas.

3) I haven’t gone back & cleaned up the code or done a whole lot of re-architecting of the project. The first versions of the code and design were quite ugly, and I cleaned up the code only to the extent that cleaning up the code helped improve the functionality of the page.

4) Some of the counties may have polygon coordinates that are off in left field, and this causes problems. I’m aware of only 1 county with this problem, so I’m not in a big rush to worry with it right now. If this were to become a production application I would manually check every county. Until then, I’ll live with an occasional page crash.

5) One of my goals was to create a page with some separation between UI & code while avoiding the constant back and forth between client and server to load UI stuff. I’m of the opinion that to the extent possible, UI elements should load & reload from the server only when the UI itself changes. When a data field changes, the UI code for that field shouldn’t reload.

County Data Intensity Map

*********************************************************************************************************

Advertisements

Leave a comment

Filed under Uncategorized