Map APIs (mappoint, google maps, etc.)




  • My company is looking to write a web-based application that plots sales data over regions on a map.  As an example, they would want to "shade" in a certain state/country/user defined polygonal region and give the user the ability to click on the link to bring up information on sales for that territory.  Presently, this is done using a desktop version of Microsoft MapPoint (my understanding is that a mappoint file is sent out and then the user needs to have the desktop mappoint program installed on their PC).  This does not seem to be an ideal solution, and my company wants to transition to a web-based version that does the same thing.

     

    I was wondering if anybody had experience doing something similar?  I have looked at the Google Maps API and came away very impressed.  Unfortunately, it doesn't seem to be a great fit for what we need.  There is a GPolygon object that lets you "draw" regions over a map, but it seems that you would need to manually plot a crapload of lattitude/longitude coordinates to simply shade in a particular state/country.  There probably is some place where this information can be downloaded or purchased, but it sure seems like all of that geocoding and plotting would cause a massive performance hit.

     

    I know that there is a web-based version of MapPoint, but I am extremely confused by what Microsoft currently offers.  It seems like there are multiple product offering (MSN Virtual earth, mappoint, etc.).  Also, it seems like the web-based version of mappoint isn't quite as powerful as the desktop version, but I am not sure.  I was wondering if anybody had firsthand experience with any of these products?  Thanks.



  • @bighusker said:


    My company is looking to write a web-based application that plots sales data over regions on a map.  As an example, they would want to "shade" in a certain state/country/user defined polygonal region and give the user the ability to click on the link to bring up information on sales for that territory.  Presently, this is done using a desktop version of Microsoft MapPoint (my understanding is that a mappoint file is sent out and then the user needs to have the desktop mappoint program installed on their PC).  This does not seem to be an ideal solution, and my company wants to transition to a web-based version that does the same thing.

     

    I was wondering if anybody had experience doing something similar?  I have looked at the Google Maps API and came away very impressed.  Unfortunately, it doesn't seem to be a great fit for what we need.  There is a GPolygon object that lets you "draw" regions over a map, but it seems that you would need to manually plot a crapload of lattitude/longitude coordinates to simply shade in a particular state/country.  There probably is some place where this information can be downloaded or purchased, but it sure seems like all of that geocoding and plotting would cause a massive performance hit.

     

    I know that there is a web-based version of MapPoint, but I am extremely confused by what Microsoft currently offers.  It seems like there are multiple product offering (MSN Virtual earth, mappoint, etc.).  Also, it seems like the web-based version of mappoint isn't quite as powerful as the desktop version, but I am not sure.  I was wondering if anybody had firsthand experience with any of these products?  Thanks.

    If you use Google maps as route planner, it offers the option to "customize your route". This involves dragging around a rectangular handle that clings "magnetically" to the route line. So at least for roads, Google seems to send the polygon trail to the client. I don't know if it helps, but maybe with some reverse engineering of their JS client, someone could query that data directly?

    Of course there would still be the problem that it's not an official API and thus the interface could be completely different tomorrow...



  • I guess it depends on exactly how those regions correspond to political reality. If one of your regions corresponds 1:1 with a state, or multiple states, then I'm sure Google and Microsoft must have some simple call that basically says "Highlight California" and the like. If not, it's time to suggest it to them. They've already got all the data server-side to draw in the borders, after all.

    If your regions are arbitrary (i.e. half of Northern California, Salt lake City, downtown Chicago and one particular tree in Central Park), then I can't see any way around it other than your proverbial crapload of coordinates.


    An alternative would be to do what Google does: pre-render all the necessary map tiles into highlighted and non-highlighted versions and swap the sets as necessary. If you don't have too large a geographic region to cover and don't need all the zoom levels Google has, it wouldn't be too large an image set.



  • @bighusker said:

    I know that there is a web-based version of MapPoint, but I am extremely confused by what Microsoft currently offers.  It seems like there are multiple product offering (MSN Virtual earth, mappoint, etc.).  Also, it seems like the web-based version of mappoint isn't quite as powerful as the desktop version, but I am not sure.  I was wondering if anybody had firsthand experience with any of these products?  Thanks.

     I do a lot of work supporting Virtual Earth, which is the general-purpose web-based platform.   MapPoint is a desktop application that has more support for overlaying data innately, but VE can do a fair bit as well. (And then there are the MapPoint Web Services, just to confuse things, but that's not really what you want here)  There's an interactive SDK for VE which you might find interesting (http://dev.live.com/virtualearth/sdk/)

     As for state boundaries, those you do need to supply on your own, unfortunately.  Yes, the data is put on the maps, but it's put on to the map tiles directly and isn't available as a separate data source.   I've done this sort of thing several times with different types of boundaries (county, zip code, etc)...it's not trivial, but it's not super-difficult either.  The main problem is that if you take the boundary data in it's entirety, you end up with a LOT of points to be drawn, which gets slow in the browser.   You also need to find and parse the data, which is annoying, but not especially hard.

    But, no, it doesn't come for free, unfortunately. 

    -cw

     



  • I'm not aware of anything within the Google maps API itself for border data. A quick digging found the following which might be useful however:

    From the looks of it US state/county border data is pretty available but country border data not so much, possibly related to some borders changing daily or being in dispute.



  • Thank you to everyone who responded. After speaking with our project
    manager, it seems that the ability to shade countries is not that
    important because we currently don't have much in the way of data
    analysis for international dealers any way (FYI: we are a large
    recreational boat-manufacturing company with several brands and dealers
    across the world).  All that we really need for international is the
    ability to plot dealer locations on the map, which wouldn't be a
    problem for either API.  For domestic dealers, we would want the
    ability to draw borders and shade counties, zip codes and states based
    on sales data.  I know that this is possible with Googlemaps based on a few mashups
    that I've seen:

     

     

    (I saw an example that shaded states somewhere, but I've misplaced the URL) 

    From
    what I've learned, most of this information (coordinates) is available
    from the US Census Burearu.  To use them with Google maps, it's a
    matter of converting their data into a KML file which can then be used
    to draw a GPolygon object on the map.

     

    According to our PM, these are the most important things we need:

    1. Ability to upload data by county and have the counties on the map shaded based on that data. (i.e. varying shades of green are used to show how many of a certain model boat was sold in each county)

    2. Have the ability to define a territory of one or more counties and have a black border around the whole defined territory.  (I believe all territories are defined as "one or more counties" and not an arbitrary region such as "Northern California", but it would be nice to be able to easily define arbitrary reasons..it looks like Google makes this possible with the ability to draw polygons on "my maps" and then export the KML file).

    3. Ability to select an area of the map and export the under-lying data (I think this could be done because you can add a click-event listener to a GPolygon object and then use java-script to redirect to a page that exports the data for the region they clicked on).  One MapPoint-desktop feature that might be hard to implement is the ability of the user to draw a rectangle around the map and then have it export to Excel based on all the counties contained in that map...

     
    From what I've seen, all of these things are fairly simple to do with the MapPoint Desktop program (mostly because it's a matter of importing static data into the program and mapping it accordingly), but they are much more difficult to pull off in the web-based APIs.  You pretty much have to do all the "border drawing" yourself, whereas that information seems to be built into MapPoint.  Does Microsoft have anything that approaches the capabilities of the MapPoint desktop program available for use on the web?  CodeWhisperer, you mentioned that VE can do a fair amount of data overlaying.  Do you know of any examples of this in action?  Thanks again guys...you've all been very helpful.



  • Sorry, it's been a crazy week and I haven't been keeping up with the thread.  

    VE lets you overlay a number of shapes on the map: simple "pushpins" for points, polylines (like for roads), and polygons.  Polygons can have fill colors, edge colors, and variable opacity.

    It can get a little slow when it comes to displaying a lot of polygons, so if you want to have more than, say, 100 of them on the map at once, you have to be tricky about it; but there are ways.

    For what you're talking about, you'll probably want more than a simple KML file.  You'll want a back end web service of some description that can serve out polygon & business data, then the web page can interact with that service in an ajaxy manner.   

    Creating the polygon is pretty easy.  Here's some sample code from the interactive SDK:

             var ll = map.GetCenter();
             var lat = ll.Latitude;
             var lon = ll.Longitude;

             var shape = new VEShape(VEShapeType.Polygon, [new VELatLong(lat,lon-0.15),
                                                       new VELatLong(lat+0.1,lon-0.05),
                                                       new VELatLong(lat+0.1,lon+0.05),
                                                       new VELatLong(lat,lon+0.15),
                                                       new VELatLong(lat-0.1,lon+0.05),
                                                       new VELatLong(lat-0.1,lon-0.05)]);
             shape.SetTitle('My polygon');
             map.AddShape(shape);

    So, imagine that in a loop, going over the data that is returned by the service and you've got the (very) basics of it.

    I can probably send you a (static) example, if you want to private-message me your email.  I'll need to strip out the client info, but you'll be able to see how the data is brought in (I just use JSON), and how VE renders it.  

    Hope that helps a bit.

    -cw


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.