Tag Archives: Virtual Earth

Updated Virtual Earth Map Control demo code

UPDATE: I’ve updated the code to use the workaround described here.  If you downloaded this code before May 2nd, 2008 @ 7:30 PM EST, then you might download it again.  The URL is the same.

I’ve update my primary Virtual Earth (VE) map control demos. If you aren’t familiar with my VE demos, they are essentially all the samples from the Virtual Earth Interactive SDK redone in a Visual Studio solution. My directory structure maps almost identically to the steps treeview in the Interactive SDK:

 image image

Then, I sprinkle in a little ASP.NET AJAX and Windows Communication Foundation (WCF) where these technologies can make building VE solutions easier. All you have to do is download the zip and you basically have the Interactive SDK code++.

Here’s what’s new in the updated code:

  • All pages use the 6.1 map control.
  • Cleaned up some AJAX code that still used really old previews from ASP.NET AJAX (Specifically Microsoft.Web.Preview.dll & Sys.Preview.UI scripts from the Microsoft AJAX Library).
  • Additional code cleanup.
  • All JavaScript files use the Virtual Earth JavaScript Intellisense Helper.
  • All JavaScript files have a reference to their corresponding .aspx page so we get full Intellisense for the Microsoft AJAX Library and any other additional .js files referenced in the ScriptManager.
  • 05 – Customize Shapes/CustomizeShapes.aspx.js has an example of how to restyle the VE InfoBox using Cascading Style Sheets (CSS).
  • 07 – Import Data/GeoRSS_Collections_KML.aspx.js shows how to import KML.
  • 08 – Custom Tile Layers/CustomTileLayers.aspx.js correctly shows the custom tiles. The web site is now configured to use a fixed port for the ASP.NET Development Server.
  • 10 – Route and directions/RouteDirections.aspx.js uses map.GetDirections() instead of map.GetRoute() since map.GetRoute() is deprecated. I also added a multipoint routing example.

You can grab the code here:

http://cid-1f72da7294089597.skydrive.live.com/self.aspx/Public/Virtual%20Earth/VEMapControlDemo_v6.1_VS2008.zip 

NEW RELEASE: Virtual Earth JavaScript Intellisense Helper

I am happy to announce that we have a new release of the Virtual Earth JavaScript Intellisense Helper to bring Intellisense in sync with the new Virtual Earth Map Control 6.1.  In addition to 6.1 compatibility, we also made the following enhancements:

  • Consolidated all scripts into a single VEJavaScriptIntellisenseHelper.js file for better portability
  • Updated Default.aspx to point to the 6.1 Map Control
  • Updated Default.aspx.js to explain how to get intellisense everywhere for a page level map variable
  • Added a readme.txt with history

The quick turnaround is a huge testament to the hard work of the devs on this project.  Although I spent a good set of hours coordinating, writing a little bit of code, and "building" this release, the majority of the work was done by the community in their free time!

We haven’t figured out a way to unit test Intellisense:) or an automated way to validate the helper against the SDK so there is always a chance we missed something.  If you you find any bugs or missing pieces, please file a work item at http://www.codeplex.com/VEJS/WorkItem/List.aspx.  You can download 6.1.041708.1040 here.

VE JavaScript Intellisense Helper bug & workaround

A bug has been discovered when using the Virtual Earth JavaScript Intellisense Helper where JavaScript Intellisense fails to surface in a very common scenario.  The scenario is when you have declared a page level map variable.  You will get Intellisense in the JavaScript function where you instantiate the map variable.  However, you will not in other functions:

image 

In the example above, you would get Intellisense for map in GetMap(), but not in Find().  The problem is that Visual Studio 2008 JavaScript Intellisense engine does not know that GetMap() gets called before Find().  Therefore, there is no way to know that the map variable used inside the Find() function is an instantiation of the VEMap class.  We are investigating the best guidance on how to handle this scenario in Visual Studio 2008. 

On the surface, the workaround seems simple.  You just need to make sure the map variable is a page level instantiation like so:

image 

Of course, this poses a problem at runtime because VEMap doesn’t have access to the ‘myMap’ div yet.  That’s the whole reason people put their map init code in window.onload, body.onload, or pageLoad() for ASP.NET AJAX based solutions.  So what to do?  For now, here is what I am doing and what I have checked-in to source control for our upcoming release that will be in sync with the Virtual Earth Map Control 6.1:

image

The good news is that you really don’t have to comment/uncomment while you are developing.  The code above will "work" as is.  I say "work" because you will get an annoying script error for the "var map = new VEMap();" line of code, but the rest of your page will function as expected.  You just want to make sure you fix things for production:).  Although this is a little bit annoying, I think it is small price to pay for getting JavaScript Intellisense for the Virtual Earth Map Control.

Virtual Earth Map Control 6.1

The control has been releases / is publicly available.  Chris Pendleton has the details in his post titled New Virtual Earth API Release – Virtual Earth 6.1.  The Virtual Earth Interactive SDK & full Virtual Earth SDK have not been update, but the updates should be out some time today.

Now that it is out, we will begin work on updating the Virtual Earth JavaScript Intellisense Helper to be in sync with any updates to the 6.1 API.

Technorati Tags: ,

WEBCAST FOLLOW UP: Geospatially Enabling SharePoint with IDV Solutions’ Visual Fusion Suite

Thanks to everyone who attended.  Thanks to Scott Caulk from IDV Solutions for being a guest presenter.  You can find Scott’s deck here.  Scott also asked I post the following links for those of you who want further information:

IDV Solutions Website

Visual Fusion Product Brochure

As always, you can view a recording of the webcast using the original Geospatially Enabling SharePoint with IDV Solutions’ Visual Fusion Suite registration link.  The recording should be available within 24 hours.  I’ve also added it to My Recorded Webcasts.

Technorati Tags: ,

WEBCAST: Geospatially Enabling SharePoint with IDV Solutions’ Visual Fusion Suite

Microsoft Office SharePoint Services 2007 (MOSS) is rapidly approaching the 100 million licenses sold milestone and SharePoint consulting services are white hot.  IDV Solutions’ Visual Fusion software extends SharePoint to create a visual composite application platform, empowering users and the enterprise to consolidate data and services surfaced in SharePoint and then compose them in the context of location and time.  In short, Visual Fusion geospatially enables SharePoint.  This webcast will inform the Microsoft developer community about the capabilities of Visual Fusion, the primacy of location and time in organizing information, and how to quickly create compelling visual composite applications.  An application will be created from the ground up, combining structured enterprise data (SharePoint Lists & Libraries, SQL Server stored procedures) with unstructured workgroup data (Excel files, KML files, and SHP files), cloud-based data (KML feeds, RSS feeds, and WMS feeds, Map Point Web services, Virtual Earth), and ad hoc contributions from the user (map annotation).  The audience will see how the combination of Visual Fusion and SharePoint results in a geospatial content management system, how portal services (Search, alerting, the business data catalog, etc.) can be leveraged to supercharge visual composite applications, and how an RIA front-end will engage, create buy-in, and facilitate collaboration among users.

When

Wednesday, April 09, 2008

2:00P-3:30P EST (11:00A-12:30P PST)

Register at this link:

http://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032373601&Culture=en-US

Technorati Tags: ,

Improving the performance of drawing large vector datasets on the Virtual Earth map.

One of the topics that comes up often when I give Virtual Earth programming talks is that there is a point where performance degrades when adding shapes (pushpins, polylines, polygons) to the map.  When depends on the complexity of the shapes you add.  I always go on to explain that this is not 100% a limitation of the map control as much as it is a limitation of the fact that the control is an JavaScript control.  Therefore, we are at the mercy / limitations of JavaScript in the browser.  The recommendations I usually make are:

  • You as the developer need to manage the shape objects on the map.  Only show what’s necessary in your given view.  For example, if you are looking at a map of the united states, don’t try to draw county polygons for a given state.  Only draw county polygons when you have zoomed in to a level where it would make sense.  After you have zoomed in, you need to clear any polygons outside the current map view.
  • I agree that the first approach takes requires an extra a bit of client side coding to manage shapes.  Another approach is to generate tiles on the server and overlay those tiles on the existing map, effectively drawing vectors in a much more efficient manner without having to creating a huge amount of JavaScript objects.  Johannes Kebeck has some great articles on how to go down that path.  I have links to the articles in my working list of Virtual Earth Resources.  Another approach is to use a third party solution like MapDotNet Server 2007 to do the heavy lifting for you.  If you are interested, check out their Interactive SDK and samples.

If using something like MapDotNet isn’t an option for you and you need to go down the "do it yourself" path, then you’ll want to check a post from Keith Kinnan I just came across titled Microsoft Research Releases Tiled Vectors Demo.  There’s some great information and code samples for you "doityourselfers."

Technorati Tags: ,

UPDATE: New Virtual Earth JavaScript Intellisense Helper release

One of our team members found a bug.  We fixed it and created a new release today.  Bug details and release download are available at http://www.codeplex.com/VEJS/Release/ProjectReleases.aspx?ReleaseId=12065.

We are ramping up for our next release.  If you are interested in what we are planning on doing/fixing, then please visit http://www.codeplex.com/VEJS/WorkItem/List.aspx.  Make sure you sort by open issues.  Please let us know if you have found any bugs in the helper or have any suggestions for the next release.  You can add work items to our list.  You can even vote on work items.  Let your voice be heard:)!

Virtual Earth: Drawing on the map and storing the result in SQL Server 2008

During my Virtual Earth Workshop at the GIS-T (www.gis-t.org) conference, I demo’d how to execute a spatial query in a VE scenario by using JavaScript, WCF, and SQL Server 2008.  The query returned GeoRSS to the browser so the VE map control could use it to draw polygons on the map.  I ingested the spatial data into SQL from ESRI shape files provided by the US Census Bureau here using a free tool available here.  I’m planning on cleaning up the code, making the sample available, and recording a channel 9 screencast explaining the sample.   As a result of the demo, I received the following email from one of the attendees:

"I would like to know if you have a demo of how I could store the coordinates created by generating points or polylines from on the map into a database. You can save them as part of collections but I would like to know how they can be stored into a database."

I do not have such a sample.  However, Johannes Kebeck, has a sweet series of posts around Virtual Earth & SQL Server 2008:

Virtual Earth & SQL Server 2008 – Part 1: Introduction (1/2)

Virtual Earth & SQL Server 2008 – Part 1: Introduction (2/2)

Virtual Earth & SQL Server 2008 – Part 2: Spatial Data Management in SQL Server 2008 (1/3)

Virtual Earth & SQL Server 2008 – Part 2: Spatial Data Management in SQL Server 2008 (2/3)

Virtual Earth & SQL Server 2008 – Part 2: Spatial Data Management in SQL Server 2008 (3/3)

Virtual Earth & SQL Server 2008 – Part 3: Getting Started with Virtual Earth

Virtual Earth & SQL Server 2008 – Part 4: Integrating SQL Server 2008 and Virtual Earth (1/6)

Virtual Earth & SQL Server 2008 – Part 4: Integrating SQL Server 2008 and Virtual Earth (2/6)

Virtual Earth & SQL Server 2008 – Part 4: Integrating SQL Server 2008 and Virtual Earth (3/6)

Virtual Earth & SQL Server 2008 – Part 4: Integrating SQL Server 2008 and Virtual Earth (4/6)

Virtual Earth & SQL Server 2008 – Part 4: Integrating SQL Server 2008 and Virtual Earth (5/6)

Virtual Earth & SQL Server 2008 – Part 4: Integrating SQL Server 2008 and Virtual Earth (6/6)

Virtual Earth & SQL Server 2008 – Part 5: Conclusion

Part 4 (6/6) is titled Inserting Data into SQL Server 2008 and answers the question.  However, Johannes takes a slightly different approach than the pattern I showed in my demo.  I love the fact that he took a fairly platform agnostic approach in his examples because it means that anyone can use the approach regardless of their client & server libraries.  However, I’m a .NET evangelist.  It’s my job to highlight our great developer platform.  We have some great libraries and APIs in the Microsoft AJAX Library / ASP.NET AJAX & the Windows Communication Foundation that could help make building out this scenario much easier.  I plan on taking the same scenario and building it out using them.  I’ll be working on it, along with my original example, in the next week or so.  When I am done, I will make the source code available and have 2 screencasts walking showing how to build them step by step.

RELEASED: Virtual Earth JavaScript Intellisense Helper

We’ve officially released!  If you’ve been paying attention to the project, you might have noticed that there was a release on March 3, 2008.  I know a few of you have been paying attention because there were 58 downloads before we released the latest version:).  We held off on announcing the release because there was a last minute fix and we wanted to use MIX as a way to kick off the release.  If you aren’t familiar with the project, see my first post here.  The purpose of this project is to make the Virtual Earth developer experience better by fully enabling JavaScript Intellisense for the Virtual Earth Map Control inside of Visual Studio 2008.

I want to take a moment to thank the community for the HUGE outpouring of support for this project.  I announced the project on a Tuesday morning.  By then next day, we had 11 people volunteer to help develop the remaining pieces.  By Friday, we had our first release complete.  That is 4 days start to finish.  In reality, it was only 3 days since I spent most of the first day refactoring and setting up the project so multiple devs could work in parallel.  I am still in awe of how fast this release came together.  I never imagined we’d get a working solution in the hands of Virtual Earth developers so fast.  The credit goes to the community!  I coded VEMap & VEAltitudeMode.  Almost everything else was done by community devs.  Of the 11 devs on the project, there were really 4 folks who coded the majority of the classes & enumerations. 

Since we were able to able to get this project done so fast, it turns out we were able to use MIX as a way to create more awareness for the project.  Chris Pendleton used it in his Developing Applications with Microsoft Virtual Earth session.  You can watch his session, and all the other MIX sessions 24 hours after they happen at the conference at http://sessions.visitmix.com/

You can get the latest release straight from the codeplex project at https://www.codeplex.com/Release/ProjectReleases.aspx?ProjectName=VEJS&ReleaseId=11338.  Please download it, use it, and tell us how we can make it better through the codeplex project at http://www.codeplex.com/VEJS.  We already have a set of works items we are thinking about for the next release.  Let us know what we’re missing.