Skip to content

Commit

Permalink
finished adding the rest of the us state constants
Browse files Browse the repository at this point in the history
  • Loading branch information
vann committed Mar 12, 2010
1 parent b9f1563 commit 3f90712
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 27 deletions.
76 changes: 70 additions & 6 deletions easy_mapr.js
Expand Up @@ -15,8 +15,9 @@ function set_latlng (latlng) {
// EX:
/*
set_marker({
address: '1234 your address',
map: map,
address: '1234 your address', // required
map: map, // required
center: true_or_false, // optional
icon: icon, // optional
info: content_or_element_id // optional
})
Expand All @@ -40,6 +41,12 @@ function set_marker (opts) {
info = undefined;
};

// center the map if it's set to true
if (is.defined(opts.center)) {
opts.map.setCenter(results[0].geometry.location);
delete opts.center;
};

marker = new google.maps.Marker(marker_opts);

// set info windows and events
Expand Down Expand Up @@ -70,16 +77,15 @@ function set_info_window (info,marker) {
infowindow.open(marker.map, marker);
});
}

/*
Set multiple markers
EX:
// pass the same arguments as set_marker hashes
set_markers([
{
address: '1206 N 37th Ave, Minneapolis, MN',
map: map
// you can add in other optional params as well
},
{
address: '1210 N 37th Ave, Minneapolis, MN',
Expand Down Expand Up @@ -110,3 +116,61 @@ var is = function() {
}
};
} ();

// latlng coordinate constants
// currently only have US states, add in other coordinates as neccessary
var coordinates = {
USA: {
AK: [63.5888, -154.4931],
AL: [32.3182, -86.9023],
AR: [35.2011, -91.8318],
AZ: [34.0489, -111.0937],
CA: [36.7783, -119.4179],
CO: [39.5501, -105.7821],
CT: [41.6032, -73.0877],
DC: [38.9060, -77.0334],
DE: [38.9108, -75.5277],
FL: [27.6648, -81.5158],
GA: [32.1574, -82.9071],
HI: [19.8987, -155.6659],
IA: [41.8780, -93.0977],
ID: [44.0682, -114.7420],
IL: [40.6331, -89.3985],
IN: [40.5512, -85.6024],
KS: [39.0119, -98.4842],
KY: [37.8393, -84.2700],
LA: [31.2448, -92.1450],
MA: [42.4072, -71.3824],
ME: [45.2538, -69.4455],
MD: [39.0458, -76.6413],
MI: [44.3148, -85.6024],
MN: [46.7296, -94.6859],
MO: [37.9643, -91.8318],
MS: [32.3547, -89.3985],
MT: [46.8797, -110.3626],
NC: [46.8797, -110.3626],
ND: [47.5515, -101.0020],
NE: [41.4925, -99.9018],
NH: [41.4925, -99.9018],
NJ: [41.4925, -99.9018],
NM: [34.9727, -105.0324],
NV: [38.8026, -116.4194],
NY: [38.8026, -116.4194],
OH: [40.4173, -82.9071],
OK: [35.0078, -97.0929],
OR: [43.8041, -120.5542],
PA: [41.2033, -77.1945],
RI: [41.5801, -71.4774],
SC: [33.8361, -81.1637],
SD: [43.9695, -99.9018],
TN: [35.5175, -86.5804],
TX: [31.9686, -99.9018],
UT: [39.3210, -111.0937],
VT: [44.5588, -72.5778],
VA: [37.4316, -78.6569],
WA: [47.7511, -120.7401],
WI: [43.7844, -88.7879],
WV: [38.5976, -80.4549],
WY: [43.0760, -107.2903]
}
};
43 changes: 22 additions & 21 deletions index.html
Expand Up @@ -12,30 +12,31 @@
function init () {
// find more map options at : http://code.google.com/apis/maps/documentation/v3/reference.html#MapOptions
var map_opts = {
zoom: 12,
// center: set_latlng([45.0221762, -93.2944366]),
zoom: 15,
center: set_latlng(coordinates.USA.MN),
mapTypeId: google.maps.MapTypeId.ROADMAP
};

map = create_map("map",map_opts);
map = create_map("map",map_opts);

set_markers([
{
address: '1206 N 37th Ave, Minneapolis, MN',
map: map
},
{
address: '3535 HUMBOLDT AVE N, Minneapolis, MN',
map: map,
icon: "images/aim_16.png",
info: "#special-house"
},
{
address: '3622 GIRARD AVE N, Minneapolis, MN',
map: map,
info: "Special House"
}
]);
set_markers([
{
address: '1206 N 37th Ave, Minneapolis, MN',
map: map
},
{
address: '3535 HUMBOLDT AVE N, Minneapolis, MN',
map: map,
center: true,
icon: "images/aim_16.png",
info: "#special-house"
},
{
address: '3622 GIRARD AVE N, Minneapolis, MN',
map: map,
info: "Special House"
}

]);

}

Expand Down

0 comments on commit 3f90712

Please sign in to comment.