tags:

views:

2153

answers:

4

I built a Winform app several months ago that schedules appointments for repair techs. I'd like to update the app by adding a map for the customer's address on the customer form, and then print that map on the report the techs take when they leave the office.

I've been looking around but I haven't found a good solution for this yet.

I currently have an address for the customer. What I'd like to do is submit the address to one of the popular online map sites and get a minimap of the locale. I can almost do this with Google maps using their embedded link feature. I can get the following HTML after adding an address to their website:

<iframe width="300" height="300" frameborder="0" scrolling="no" 
   marginheight="0" marginwidth="0" 
   src="http://maps.google.com/maps?hl=en&amp;amp;ie=UTF8&amp;amp;t=h&amp;amp;g=1193+Presque+Isle+Dr,+Port+Charlotte,+FL+33952&amp;amp;s=AARTsJqsWtjYwJ7ucpVS6UU2EInkRk6JLA&amp;amp;ll=27.012108,-82.087955&amp;amp;spn=0.005735,0.006437&amp;amp;z=16&amp;amp;output=embed"&gt;
</iframe>

My first plan was to simply parse this HTML and insert whichever customer's address was needed in place this address, then show the result in a browser object on the form. However, if I change the address in the above iframe Google gives me a "Your client does not have permission to get URL ..." message.

I have no preference on which map service I ultimately use, the important thing is that the solution can't have an associated expenses and its usable from Windows forms.

Anyone got an ideas/recommendations/resources on how to tackle this?

Results:

I ended up using the control found here. I find it an "okay" solution... it's tedious to get working as the code does not work as-is. I'm pretty stunned to find that none of the popular map APIs support winforms.

A: 

Both Google Maps and Live Maps have a public api.

Since you are doing winforms I'd probably use live maps.

http://dev.live.com/VirtualEarth/

There are a few examples on CodePlex.

http://codeplex.com/Project/ProjectDirectory.aspx?TagName=Virtual%20Earth

Stever B
None of the above solutions were very good, but since I used a control I found on codeplex I gave this answer the checkmark. :)
Sailing Judo
A: 

There is some example code for developing a map viewer control (NB: I doubt this is strictly within their licence)

Otherwise, depending on your budget, you could use the MapPoint ActiveX control

Rowland Shaw
+1  A: 

check http://greatmaps.codeplex.com/

radioman
This is a year and a half after I needed it, but its great.
Sailing Judo
A: 

Just use the value inside the src="" as the location for a WebBrowser control directly, without the IFRAME.

OR

Build a minimal html document wrapping the IFRAME, write it out to a MemoryStream, re-seek it back to the start, and use the MemoryStream to set the WebBrowser control's DocumentStream property.

PW

PolicyWatcher