3D Visualization & Analytics

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

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. So how did this happen? It does require a little black magic.

These are the steps that I followed:

def callWhat3Words(self, lon=0, lat=0, elv=0):
  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!

About the author


Inline Feedbacks
View all comments

Next Article

Multidimensional PCA in ArcGIS

Read this article