One of the many benefits of our Geocortex Essentials technology is its ability to integrate with virtually any key 3rd party business system or data source.
There is no need to duplicate, move or reconfigure your data for a proper integration when it comes to using Geocortex applications; your data can simply flow seamlessly between systems, allowing for you to access your information faster and more efficiently.
With that in mind, we thought that this week’s Geocortex Tech Tip would be a great opportunity to focus on this in more depth by showing you how to use Geocortex Essentials to integrate with third party map providers like Bing Maps and Pictometry.
“Hello and welcome to Geocortex Tech tips. My name is Jonathan and today we are going to be talking about how to integrate third party maps with your applications such as Pictometry, Bing and other providers.
Let’s get started!
First of all, I got a viewer set up here, so let’s take a look at the feature and see how it works! If I go to the ‘Linked Maps’ button here, I can bring up a view at the bottom of the screen and – make that a little bit bigger – and our default provider here is Bing Maps. You can see I’ve got an icon on the map here that I can move around to change the point on the map that I’m looking at, and drag it over to that heliport there, and then down here on Bing Maps we can see a heliport on top of that building right there – it’s probably the same one.
If we look at that we can see that’s the Los Angeles Times building and the Los Angeles Times Heliport. Nice! So how is this configured? Let’s take a look first at our desktop json.js. We can see the integration module, and then in the configuration for the integration module we have some external components, ‘bingMaps’ and ‘pictometry’ and we have defined ‘bingMaps’ as the default component. And bingMaps tells it to load a page from ‘Resources/3rdPartyMaps/BingsMaps.html’, and it tells it to use this icon for the little dragable indicator that you see on the map.
If we go and we look in the viewer installation directory (that’s what this is pointing to so it will be HTML5 viewer/Resources/3rdPartyMaps in your IIS folder) and then we’ll take a look at a copy of that file, and first thing you need to know – you don’t need to know any of this code necessarily – but you do need to find the spot on the page where it says ‘bingAPIKey’ and you need to put your API key that you got from the Bing Maps API developer website, and put it in there to make it work properly because otherwise you will get a nice message from Microsoft on top of your map.
So that out of the box is the only step required to make this all work properly and then you can configure it here like so and view it in the viewer like so.
Let’s look at another provider that we have called Pictometry. We’re going to move over to this version of the site here because I don’t have an API key that works on mine, so open the linked maps, and you can see that’s not the one that we want (whoops!)
All right, there’s Pictometry – and let’s pop this out to get a little bit of a better view. That came up in a new tab by default, but let’s just put it side-by-side on the screen with our map like so.
We can see our marker here (we’re a little bit in an industrial wasteland). Let’s take a look at something a little bit more interesting. See if we can go over to Dodger Stadium. There we go!
So, we have some very nice high-res Pictometry imagery of Dodger Stadium. Doesn’t look like a game is on today. We can look at some different imagery to see what’s happening. No game there. Oh there look a game is on, oh but not there. The field is closed for maintenance.
Anyway, I won’t go into depth on how to use the Pictometry tool – it’s basically the same as any other third party maps integration. If we take a look at the configuration page, it’s very similar. Now we need an API key and a secret key and you’ll get those from your Pictometry vendor, and they go in those spots and that’s all that’s required to make this work.
Now I’d like to cover how you would hook this system up to any third party map provider. Say you wanted to make your own, and you didn’t want to use these default ones.
Then we make a new third party map, we call it ‘bingMaps’ and we pass it in a function to initialize the map and then our three handler functions that were defined above there. The initialize map function is just down here and that’s where the API key is provided.
So, what goes in initialize map is whatever that third party API needs to bring up a map on a webpage. And what goes in here is, you have to return a center with an ‘X’ and ‘Y’ a scale and a heading, and just return an object with those values that you get from the API of the third party map’s control. Then when you handle the viewpoint indicator updated you just get a point with ‘X’ and ‘Y’ coordinates because you’re just sitting in your ‘X’ and ‘Y’ on the map.
The viewer position updated event is a little bit more complicated because we could also be zooming in and out of different scales and changing the extent. So that takes an object with a bunch of properties like extent, positions, scale, heading, pitch – we can use some of these extra properties to handle things like a street view type map as well as your traditional 2D mapping applications.
Without getting into too much of the details of coding, that’s basically the interface for creating your own, and that’s all you really need for something as simple as Bing Maps to something more complicated like Pictometry or a street view application.
Thanks for listening. This has been Geocortex Tech tips and I hope you have fun using this feature on your own viewer’s insights.
To learn more about how you can extend the reach and capabilities of your mapping applications, download our integrations eBook below!