I am looking for a way to add Google Earth imagery to ArcMap 10. Over a year ago, a GIS.SE member mentioned Arc2Earth was the only way to accomplish this (04/2011 thread). Another somewhat convoluted approach is described here. Has there been any progress in bringing Google Earth imagery to ArcGIS?
[GIS] Add Google Basemap to ArcGIS
arcgis-10.0arcgis-desktoparcmapgoogle earth
Related Solutions
I haven't tested this much, but it seems to work ...
public class TestButton : ESRI.ArcGIS.Desktop.AddIns.Button
{
public TestButton()
{
}
protected override void OnClick()
{
try
{
var fLayer = StartEditing();
if (fLayer != null)
{
ShowTemplate(fLayer);
// id discovered using Categories.exe ...
ShowDockWin("esriEditor.CreateFeatureDockWin");
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private static void ShowDockWin(string id)
{
var dockWin = GetDockWindow(id);
if (dockWin != null)
{
if (!dockWin.IsVisible())
dockWin.Show(true);
}
}
private static IFeatureLayer StartEditing()
{
IEditor editor = ArcMap.Application.FindExtensionByName("ESRI Object Editor") as IEditor;
IFeatureLayer fLayer = null;
if (editor.EditState == esriEditState.esriStateNotEditing)
{
fLayer = ArcMap.Document.FocusMap.get_Layer(0) as IFeatureLayer;
if (fLayer == null)
{
MessageBox.Show("first layer is not a featurelayer");
return null;
}
editor.StartEditing(((IDataset)fLayer).Workspace);
}
else
MessageBox.Show("you are already editing");
return fLayer;
}
private static void ShowTemplate(IFeatureLayer fLayer)
{
var ed3 = ArcMap.Application.FindExtensionByName("ESRI Object Editor") as IEditor3;
var template = FindTemplate(ed3, fLayer);
if (template == null)
{
IEditTemplateFactory factory = new EditTemplateFactoryClass();
template = factory.Create(fLayer.Name, fLayer);
ed3.AddTemplates(ToArray(template));
}
if(ed3.CurrentTemplate != template)
ed3.CurrentTemplate = template;
}
private static IArray ToArray(params object[] args)
{
IArray array = new ArrayClass();
foreach (object o in args)
array.Add(o);
return array;
}
private static IEditTemplate FindTemplate(IEditor3 ed3, ILayer layer)
{
for (int i = 0; i < ed3.TemplateCount; i++)
{
if (ed3.get_Template(i).Layer == layer)
{
ed3.CurrentTemplate = ed3.get_Template(i);
return ed3.get_Template(i);
}
}
return null;
}
private static IDockableWindow GetDockWindow(string id)
{
UID uid = new UIDClass();
try
{
uid.Value = id;
}
catch
{
MessageBox.Show("unable to create dockable window for " + id);
}
var dwm = ArcMap.Application as IDockableWindowManager;
var dockWin = dwm.GetDockableWindow(uid);
return dockWin;
}
protected override void OnUpdate()
{
}
}
You seem to be encountering NIM099128:
Converting a Map or Layer to Key Markup Language (KML) when a layer has a formatted label expression; the expression displayed in the KML is not what is labeled.
The only workaround listed is to:
Format the labels through the standard label symbology, and not by using an expression.
The problem seems to have first been reported at ArcGIS 10.2.1, and appears to be assigned to a developer to address, but if you need a solution sooner rather than later, then it looks like you may need to develop your own workaround, because I do not think the above will meet your requirements.
Best Answer
I agree Google's imagery is better than Bing's in many cases. I also think the answer is correct, that you can't use Google's imagery inside ArcGIS and probably won't be able to - ever. If you're in Minnesota, we've taken a stab at this problem by setting up a "Composite Imagery Service": http://www.mngeo.state.mn.us/chouse/wms/composite_image.html
It is very "Google-like" in that it provides a single layer image service that automatically switches to an appropriate set of air photos or satellite imagery depending on the scale and extent. We update the "low altitude" imagery as much as we can to keep it fresh. The images are provided as a WMS. I know this isn't an answer nationwide, but I thought it would be useful to post this here in case any Minnesota users ask this question. I also encourage other states to do the same thing.