//Plot the point and center and zoom to location function MapAddress(data) { //Map Symobol pin map.graphics.clear(); var symbol = new esri.symbol.PictureMarkerSymbol('themes/images/Pin.png', 32, 32); //Popup template var attributes = { addressLine: data.GeoCodeResults[0].addressLine, city: data.GeoCodeResults[0].city + ", " + data.GeoCodeResults[0].state + " " + data.GeoCodeResults[0].zip, long: data.GeoCodeResults[0].location.longitude, lat: data.GeoCodeResults[0].location.latitude, matchMsg: data.GeoCodeResults[0].matchMsg }; //Using This for infoWindow var infoTemplate = new esri.InfoTemplate("Mapped Address", "Address: ${addressLine}<br />City, State: ${city} ${state} ${zip}<br />Longitude: ${long}<br />Latitude: ${lat}<br />Match Message: ${matchMsg}"); /* Regular Popup - This works when using esri.dijit.Popup var infoTemplate = new esri.dijit.PopupTemplate({ title: "Mapped Address", fieldInfos: [ { fieldName: "addressLine", visible: true, label: "Address:" }, { fieldName: "city", visible: true, label: "City, State:" }, { fieldName: "long", visible: true, label: "Longitude:" }, { fieldName: "lat", visible: true, label: "Latitude:" }, { fieldName: "matchMsg", visible: true, label: "Match:" } ], showAttachments: false });*/ //Build point to map point = esri.geometry.geographicToWebMercator(new esri.geometry.Point(data.GeoCodeResults[0].location.longitude, data.GeoCodeResults[0].location.latitude)); var graphic = new esri.Graphic(point, symbol, attributes, infoTemplate); //Add to map and zoom map.graphics.add(graphic); map.centerAndZoom(point, 12); }
Solved! Go to Solution.