Thank you Terry I got it working now. The only problem now is that X and Y need to be swapped for the Google syntax. I tried changing it in the code but to no avail. I can't figure out why.using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
namespace StreetViewAddin_Camarillo
{
public class StreetViewHyperlink : ESRI.ArcGIS.Desktop.AddIns.Tool
{
public StreetViewHyperlink()
{
}
protected override void OnUpdate()
{
}
//private const string USER_PROMPT_3 = "Are you sure you want to hyperlink to IStreetView?";
private const string CAPTION_3 = "Hyperlink to IStreet";
protected override void OnMouseDown(ESRI.ArcGIS.Desktop.AddIns.Tool.MouseEventArgs arg)
{
//var result = System.Windows.Forms.MessageBox.Show(USER_PROMPT_3, CAPTION_3,
// System.Windows.Forms.MessageBoxButtons.YesNo,
// System.Windows.Forms.MessageBoxIcon.Question);
//if (result == System.Windows.Forms.DialogResult.Yes)
{
//Get coordinates from MouseEventArgs
ESRI.ArcGIS.ArcMapUI.IMxDocument mxDoc = ArcMap.Document;
ESRI.ArcGIS.Carto.IActiveView activeView = mxDoc.FocusMap as ESRI.ArcGIS.Carto.IActiveView;
ESRI.ArcGIS.Geometry.IPoint point = activeView.ScreenDisplay.DisplayTransformation.ToMapPoint(arg.Y, arg.X) as ESRI.ArcGIS.Geometry.IPoint;
//project pt to WGS84
System.Type factoryType = null;
factoryType = System.Type.GetTypeFromProgID("esriGeometry.SpatialReferenceEnvironment");
ESRI.ArcGIS.Geometry.ISpatialReferenceFactory srFact = new ESRI.ArcGIS.Geometry.SpatialReferenceEnvironment();
ESRI.ArcGIS.Geometry.IGeographicCoordinateSystem srWGS84 = srFact.CreateGeographicCoordinateSystem(4326);
point.Project(srWGS84);
//Open IStreetView in default browser
System.Diagnostics.Process.Start("http://maps.google.com/maps?q=&layer=c&cbll="
+ point.Y + "," + point.X + "&cbp=12,100,0,0,0&output=svembed&t=m&z=17");
}
}
}
}