JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://maps.google.com/maps?file=api&amp;v=2.x&amp;key=ABQIAAAA3gnV48oo5fz-o4eTHQuERRTHgwW9hMoRQGJ8Kzpwz2i9N66GmRSSllK6cLGF-Ib748xNrLHMPRAF6w"></script>
<div id="map_canvas" style="width: 100%; height: 650px"></div>
JavaScript
var map = null;
var geocoder = null;
// Create a base icon for all of our markers that specifies the
// shadow, icon dimensions, etc.
var baseIcon = new GIcon(G_DEFAULT_ICON);
baseIcon.shadow = "";
baseIcon.iconSize = new GSize(15, 32);
baseIcon.shadowSize = new GSize(37, 34);
baseIcon.iconAnchor = new GPoint(15, 32);
baseIcon.infoWindowAnchor = new GPoint(9, 2);
function createMarker(point, index) {
var letteredIcon = new GIcon(baseIcon);
letteredIcon.image = "https://jira.appcelerator.org/secure/attachmentzip/unzip/94528/29097%5B6%5D/Resources/android/images/medium/MapPin.png";
// Set up our GMarkerOptions object
markerOptions = { icon: letteredIcon };
var marker = new GMarker(point, markerOptions);
GEvent.addListener(marker, "click", function () {
marker.openInfoWindowHtml("Marker <b>" + letter + "</b>");
});
return marker;
}
function initialize() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map_canvas"));
geocoder = new GClientGeocoder();
}
}
function showAddress(address) {
if (geocoder) {
geocoder.getLatLng(address,
function (point) {
if (!point) {
alert("Bajs!");
} else {
map.setCenter(point, 15);
map.addOverlay(createMarker(point, 15));
}
}
);
}
}
initialize();
showAddress('uppsala');