Dan Hounshell asked me what’s my territory in response to my announcement about taking on the RIA Architect Evangelist Roll. I thought about just typing out the response, but then I realized that that would be very un-RIA of me and it would, as many standard HTML pages do, fail to really help people visualize where I’m working.
The first one that I thought of was a Virtual Earth map overlay. I used to think these were hard until Larry Clarkin showed me how easy these were to do. I’ll be doing a lot of these over time as I start doing mashups for events and the like. The hope is to start doing a GeoRSS feed at some point that will have a list of events that I’ll be at, where to find registration and the like. This has been in the plans for quite a while, the questions where to host it and the like are interfering with progress.
However, for right now, I’m just going to do the simple layer over Virtual Earth to show you the Central Region.
This was relatively simple to do. All of the code that you need to get started can be found on the Interactive SDK which makes this the best documented API I’ve seen Microsoft produce.
This is the code that I wrote. Notice the “…” which means that there’s about another 20 lines of those to make the central region shape. The hardest part of this one was getting all the latitude/longitudes right. I didn’t get it perfect but it’s close.
var fillColor = new VEColor(0,0,255,0.2); //Transparent Blue
var centralRegion = new VEShape(VEShapeType.Polygon,
[new VELatLong(48.99989069893174, -104.04843181371691),// North West Corner
new VELatLong(41.0017229451484, -104.05321687459947),
new VELatLong(41.00233021312762, -102.05171227455139), //KS NW Corner
new VELatLong(49.38326680201004, -95.15361785888673),
new VELatLong(48.998803197833915, -95.15284538269043)
map.SetCenterAndZoom(new VELatLong(38.47939467327643, -90.087890625), 4);
function AddShape(shape, fillColor)
shape.HideIcon(); //Don’t need the pushpin
//Set the line color
var lineColor = new VEColor(0,0,0,1.0); //Black
//Set the line width
var lineWidth = Math.round(1);
//Set the fill color
//Set the info box
//Add the shape the the map