I created a pretty simple tool that does this. It looked something like this:
using System.Threading.Tasks;
using System.Diagnostics;
using ArcGIS.Desktop.Mapping;
using ArcGIS.Desktop.Framework.Threading.Tasks;
using ArcGIS.Core.Geometry;
namespace ProAddins
{
internal class OpenStreetviewTool : MapTool
{
protected override void OnToolMouseDown(MapViewMouseButtonEventArgs e)
{
if (e.ChangedButton == System.Windows.Input.MouseButton.Left)
e.Handled = true; //Handle the event args to get the call to the corresponding async method
}
protected override Task HandleMouseDownAsync(MapViewMouseButtonEventArgs e)
{
return QueuedTask.Run(() =>
{
// Convert the clicked point in client coordinates to the corresponding map coordinates.
MapPoint mapPoint = MapView.Active.ClientToMap(e.ClientPoint);
// convert to lon/lat
MapPoint coords = (MapPoint)GeometryEngine.Instance.Project(mapPoint, SpatialReferences.WGS84);
// open a web browser
string url = string.Format("http://maps.google.com/?cbll={0},{1}&cbp=12,90,0,0,5&layer=c", coords.Y, coords.X);
Process.Start(url);
});
}
}
}
You also need some daml config. I added it to the map navigation toolbar:
<updateModule refID="esri_mapping">
<groups>
<updateGroup refID="esri_mapping_navigateGroup">
<insertTool refID="ProAddins_OpenStreetviewTool" size="large" />
</updateGroup>
</groups>
</updateModule>
Also I just published the addins: Release First Public Release of the Addin tool collection · roemhildtg/arcgis-pro-addins · GitHub
The streetview tool is bundled in with some other buttons so you might want to build it yourself with out the beacon tool, for instance.
@SharonAnderson2 I see that Beacon button in the screenshot. I believe in the version I had in 2.9 it said something like "Parcel" - don't remember for sure. Can for sure remove when I export.
I think I can recompile it, but not sure about reposting it. Anyone know the legality or courtesy of taking someone else's code, recompiling, and reposting on their own Github account? Sounds really fishy to me.
for Pro or otherwise the FAQ link seems not
Hi Dan
There was a street view add-in for Pro 1.1 that I used for a while, but this add-in is no longer compatible with the newer versions of Pro. For the life of me I cannot recall where I got this add-in from!
If I now try and run the add-in, the resulting error message seems to be written in Italian (based on Google Translate). The add-in was called PAMStreetView and there are no contact details with the associated files.
The ReadMe.txt file contains the following text:
Double click on PAMStreetView.esriAddInX file for install.
Note:
Street View requires WGS84 so add-in projects from your coordinate system current of Map to wgs84 (for now only coordinate system based on a datum wgs84)
Tested with ArcGIS Pro 1.1.1
For a bug of ArcGIS Pro 1.1.1 I use a rest service for projection in wgs84. In arcgis pro 1.2 I will use arcgis pro api
Version 1.0: initial version
So not to worry about this any further.
I am hoping that there may be other Pro users out there that are aware of this add-in, or other similar 3rd party add-ins, that may be of assistance.
The only source I can think of is ArcGIS Code Sharing and the links there with Streeview are limited
Thanks Dan, I agree. I took a look at this site before writing through
GeoNet but I did not find any similar add-ins or scripts.
Yes, I have developed this add-in but Google Maps APIs Terms of Service doesn't permit (10.4d)
You could use BingStreetside
I tried running the code in VS and it says it wont build. Im new to VS, how do I get it to work? Or will it not work due to google's terms of service?
Hi,
I'm in the process of trying to figure out how to convert our Google Streeview tool from a 10.2 Add-In to an ArcPro Add-In. The code is below for 10.2. If anyone can help me figure out how to convert it, it would be much appreciated.
After adding the tool to ArcMap, you just click on the tool, then click on the map and streetview open in a web browser. Pretty simple.
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using ESRI.ArcGIS.Framework;
using ESRI.ArcGIS.ArcMapUI;
namespace GoogleStreetView_Add_In
{
public class GoogleStreetView : ESRI.ArcGIS.Desktop.AddIns.Tool
{
private ESRI.ArcGIS.Carto.IActiveView activeView;
public GoogleStreetView()
{
}
protected override void OnUpdate()
{
Enabled = ArcMap.Application != null;
}
protected override void OnMouseDown(MouseEventArgs arg)
{
ESRI.ArcGIS.ArcMapUI.IMxDocument mxDoc = (IMxDocument)ArcMap.Document;
activeView = (ESRI.ArcGIS.Carto.IActiveView)mxDoc.FocusMap;
//Get the screen coordinates of the mouse down event
ESRI.ArcGIS.Geometry.IPoint mousePoint = new ESRI.ArcGIS.Geometry.Point();
mousePoint.X = arg.X;
mousePoint.Y = arg.Y;
//Get the map coordinate of the event
ESRI.ArcGIS.Geometry.IPoint mapPoint = new ESRI.ArcGIS.Geometry.Point();
mapPoint = GetMapCoordinatesFromScreenCoordinates(mousePoint, activeView);
//MessageBox.Show(mapPoint.X.ToString() + " " + mapPoint.Y.ToString());
//Transform the coordinate to a GCS
ESRI.ArcGIS.Geometry.IGeometry geometry = mapPoint;
ESRI.ArcGIS.Geometry.ISpatialReferenceFactory3 srf3 = new ESRI.ArcGIS.Geometry.SpatialReferenceEnvironmentClass();
ESRI.ArcGIS.Geometry.GeographicCoordinateSystem gcs = (ESRI.ArcGIS.Geometry.GeographicCoordinateSystem)srf3.CreateGeographicCoordinateSystem((int)ESRI.ArcGIS.Geometry.esriSRGeoCSType.esriSRGeoCS_NAD1983);
ESRI.ArcGIS.Geometry.ISpatialReference3 spatialRef3 = (ESRI.ArcGIS.Geometry.ISpatialReference3)gcs;
spatialRef3.SetFalseOriginAndUnits(-180, -90, 1000000);
geometry.Project(spatialRef3);
//Show in web browser
string streetViewLink = @"http://maps.google.ca/maps?q=" + mapPoint.Y.ToString() + "," + mapPoint.X.ToString() + "&num1&s11=" + mapPoint.Y.ToString() + "," + mapPoint.X.ToString() + "&sspn=16.71875,56.536561&ie=UTF8&ll=" + mapPoint.Y.ToString() + "," + mapPoint.X.ToString() + "&spn=0.020401,0.028753&z=15&layer=c&cbll=" + mapPoint.Y.ToString() + "," + mapPoint.X.ToString() + "&panoid=&cbp=12,161.92,,0,5";
System.Diagnostics.Process.Start(streetViewLink);
}
//Get the Map coordinate using the mouse coordinate
public ESRI.ArcGIS.Geometry.IPoint GetMapCoordinatesFromScreenCoordinates(ESRI.ArcGIS.Geometry.IPoint screenPoint, ESRI.ArcGIS.Carto.IActiveView activeView)
{
if (screenPoint == null || screenPoint.IsEmpty || activeView == null)
{
return null;
}
ESRI.ArcGIS.Display.IScreenDisplay screenDisplay = activeView.ScreenDisplay;
ESRI.ArcGIS.Display.IDisplayTransformation displayTransformation =
screenDisplay.DisplayTransformation;
return displayTransformation.ToMapPoint((System.Int32)screenPoint.X, (System.Int32)screenPoint.Y);
}
}
}
I created a pretty simple tool that does this. It looked something like this:
using System.Threading.Tasks;
using System.Diagnostics;
using ArcGIS.Desktop.Mapping;
using ArcGIS.Desktop.Framework.Threading.Tasks;
using ArcGIS.Core.Geometry;
namespace ProAddins
{
internal class OpenStreetviewTool : MapTool
{
protected override void OnToolMouseDown(MapViewMouseButtonEventArgs e)
{
if (e.ChangedButton == System.Windows.Input.MouseButton.Left)
e.Handled = true; //Handle the event args to get the call to the corresponding async method
}
protected override Task HandleMouseDownAsync(MapViewMouseButtonEventArgs e)
{
return QueuedTask.Run(() =>
{
// Convert the clicked point in client coordinates to the corresponding map coordinates.
MapPoint mapPoint = MapView.Active.ClientToMap(e.ClientPoint);
// convert to lon/lat
MapPoint coords = (MapPoint)GeometryEngine.Instance.Project(mapPoint, SpatialReferences.WGS84);
// open a web browser
string url = string.Format("http://maps.google.com/?cbll={0},{1}&cbp=12,90,0,0,5&layer=c", coords.Y, coords.X);
Process.Start(url);
});
}
}
}
You also need some daml config. I added it to the map navigation toolbar:
<updateModule refID="esri_mapping">
<groups>
<updateGroup refID="esri_mapping_navigateGroup">
<insertTool refID="ProAddins_OpenStreetviewTool" size="large" />
</updateGroup>
</groups>
</updateModule>
Also I just published the addins: Release First Public Release of the Addin tool collection · roemhildtg/arcgis-pro-addins · GitHub
The streetview tool is bundled in with some other buttons so you might want to build it yourself with out the beacon tool, for instance.
Perfect, works like a charm and I have tested it on Pro 2.1 Beta.
Thanks so much for sharing.