Point Based Service access with ArcGIS Earth

In honor of the Esri Developers Summit going on right now in Palm Springs, California, I thought that I’d provide a quick look at a hidden capability in ArcGIS Earth 1.0 that allows a developer to enable end users to access additional information about a location.

Note: If you haven’t downloaded ArcGIS Earth, yet, get it here!

If you take a look at the Administer web pages in the ArcGIS Earth documentation, you can see an innocuous entry called ServiceURL that can be configured in the ArcGISEarth.exe.config file that is in the Earth install directory.  The secret to this parameter is that it allows an administrator to enter a URL with some encoded values that will be recognized by Earth and filled with location information.  When a user then uses CTRL-RIGHT-CLICK on the globe, the URL will be invoked and the latitude, longitude, and elevation of the point clicked will be passed to that URL.  As long as the URL returns valid KML, the KML will be displayed in the Earth viewport.

In doing some experimentation, I found that I could add a call to What3Words so that I can get the unique three word location for any spot on the planet.

What3Words embedded in ArcGIS Earth
What3Words embedded in ArcGIS Earth

We’ve had many users ask us for Google-like street view capability. While we don’t have that right now, I can demonstrated that I can call Google StreetView from inside ArcGIS Earth.

Google Street view with a Trimble 3D Warehouse model in the background in ArcGIS Earth
Google Street view with a Trimble 3D Warehouse model in the background in ArcGIS Earth

In the same way, I could be able to call a Mapillary or HERE service as well.  In experimenting with this, I found some limitations to the Earth embedded browser that I need to further investigate, especially when calling apps with JavaScript.

What3Words doesn’t export KML. Neither do the new Google StreetView APIs.  So how did this happen? It does require a little black magic.

These are the steps that I followed:

<?xml version="1.0" encoding="UTF-8"?>
def callWhat3Words(self, lon=0, lat=0, elv=0):
  cherrypy.response.headers['Content-Type']= 'text/xml'
  w3wURL = 'https://api.what3words.com/position?key={MYKEYNOTYOURS}&position=' 
     + str(lat) + ',' + str(lon)
  req = urllib.request.Request(w3wURL)
  c = urllib.request.urlopen(req)
  res = c.read()
  data = json.loads(res.decode("utf-8"))
  #Build my HTML that will be embedded in KML
  description1 = 
    '<div height=250 width=400 style="font-family:Verdana;">' + 
    '<img src=""' + 
    ' height=139 width=400/>' + 
    '<p><span style="color:blue">' + 
     data['words'][0] + ':' + 
     data['words'][1] + ':' + 
     data['words'][2] + 
  description2 = ''
  #Load and modify the KML template
  kmlFile = open('home/templates/response.kml', 'r')
  result = kmlFile.read() 
  result = result.replace("%lon%", str(lon)).
    replace("%lat%", str(lat)).
    replace("%elevation%", str(elv)).
    replace("%description1%", description1).
    replace("%description2%", description2).
    replace("%title%", "What3Words Test")
  return result
 <add key="urlwithpos" 
What3Words in Rome
What3Words in Rome

You could conceivably call any URL that can accept coordinates and which could return KML. If you launch a web page you could, for example, call other services or data links that could add data into your workspace.

Here are a few tips:

Let us know if you are able to use this to add any interesting capability into Earth! Later in the year we are planning on releasing an API or SDK and we really look forward to seeing what users will be able to do then.

See you around the #DevSummit!


Chris Andrews is an experienced product management and technology leader who thrives on solving problems, establishing high performance teams, and connecting people and businesses in positive collaborations. He currently is the senior product manager for 3D across the ArcGIS platform at Esri, based in Southern California. Andrews has focused on strategic innovation, defining and driving to production new products at top tier software companies. He strives to positively impact millions of GIS users through better experience and by connecting data and technology to solve problems. Andrews is a 3D evangelist who has numerous speaking and writing credits to his name. He is active on social media and provides mentoring on 3D, product management, and technical career growth.


Next Article

Embed a Story Map within a Story Map

Read this article