måndag 17 juli 2017

Extended geospatial routing service in Bing Maps?

Sometimes GIS are complicated. Especially when it comes to access to data. I remember when I was building a dynamic routing engine based on PostGIS and data from Navteq. The dynamic part consisted of different vehicles behaving different in traffic. For example a truck or bus doesn't behave in the same way as a motorcycle or car. And moreover there can be obstacles, for example height and weight on bridges or the curve is too narrow. Most of the routing engines today are fast - not dynamic, or dynamic and less fast. 

However, after discussed with a good friend about the secret keys to routing, using most of networks SQL indexes skills, adding some routing tricks we manage to make it pretty fast and dynamic, for the time being (2011). But it was hard to make it scale. Routing is CPU heavy and there are no rights and wrongs when it comes to routing. For example, the best route can be the shortest, fastest, safest or maybe most beautiful! 


During that time I also played with isochrones. An isochrone is the routing extent, for example 50 km from a given point. Not just a circle. In every case 50 km radius covering a bigger area than the corresponding isochrone. I have seen many municipalities using radius for example for the fire department. However, project Nanjing addresses that issue.

Radius and Isochrone showing approximately 60 km from
Sundsvall, Sweden
Projects as Nanjing are important making complicated use cases available for the public. Many organizations doesn't have the knowledge, fundings etc to pull this off. Using real distances, or time to calculate coverage or use it for further processing. I hope many other data providers with API:s will consider taking a GeoJSON as an argument. In that way, it will be possible to from a GeoJSON as one criteria among others. Project Wollongong from Microsoft probably makes that behind the scenes. 

After trying the Nanjing API for the first time I was a bit surprised. I expected a GeoJSON as response, but it was a JSON with geographical information. It is not a big thing and it is easy to serialize - but I was surprised. My experience is to use standards whenever it possible. And in this case sending geographical information as JSON I use GeoJSON. The projects API is pretty straight forward to use and there are examples in a handful of languages.

However project Nanjing as a really new cool useful geospatial feature available for preview as today. I hope it will be part of the Bing Maps platform since it address an important useful feature.

There are several others project available for preview and a presentation on channel9.

tisdag 4 juli 2017


In the first part, I described how to build for a robust GIS system. In this part I’ll move on to static maps and modules.

The Pogo Rent Website have a need to show a few non-interactive map images where it is great to Pogo. Moreover, the company also wants to send confirmation e-mails to customers who have booked a pogo. In the e-mail maps should be included showing great place to pogo in the area where they have rented the pogo.

Static Maps

Static maps are great. In many cases you just need to provide an image. You really don’t need an interactive map. Sometimes you just want to show a location, or a route between locations. For this purpose, static maps are great. So where does static maps fit in our solution? On our web site! We want to show spots where it is great to pogo. It is really easy to embed a static map. Just treat it as any image! For example
<img src="http://dev.virtualearth.net/REST/v1/Imagery/Map/Road/-28.014407569005286,153.42029571533203/12?mapSize=200,200&key={BING KEY} />

The above will include an image on a web page that is 200x200px in size. Since it is an image it can be treated as an image. For example, put them in a slider. It is a bit tricky to get the URL correct, here is the documentation on MSDN https://msdn.microsoft.com/en-us/library/ff701724.aspx. And a 3rd party configuration tool is available online here http://staticmapmaker.com/bing/.
In the example site, I have just included static maps as images since it fits our purpose of showing where to pogo.


Modules is a pluggable technique to add functions to Bing Maps. In the demo site the GeoJSON module being used. There are a several modules, for a complete list see here, https://msdn.microsoft.com/en-us/library/dd877180.aspx. There is also an open source project for modules on Codeplex. The project is originally for Bing Maps v7 control, the good news is most of them works with v8 control. There is a compability list here https://bingmapsv7modules.codeplex.com/wikipage?title=Module%20Compatibility%20with%20Bing%20Maps%20V8.

Open source Modules

The v7 contral has an open source project for modules. I think the modules for v8 control should be released as Open Source, with a MIT-license. Modules extends the control and therefor it provides a great opportunity for developers to modify, enhance, extend modules to fill their needs. V7 control has a great project, I know many modules works for v8 control. Combining v7 modules and v8 modules would be a powerful combination. I think the modules have a place on GitHub like many other Bing Maps project from Microsoft. More over, I think Microsoft is the natural coordinator and organizer of such open source project. There is a risk that there will be modules spread in different repositories and no compilation of the modules.  The compiled list on Codeplex is really an asset. It also gives a hint of no of contributors that work in one place. So with this paragraph I really encourage to coordinate such project to keep the modules together.

The code is here on GITHUB and a live example temporary hosted here..