Vishful thinking…

Tiling Vector Data for VirtualEarth applications

Posted in Uncategorized by viswaug on January 21, 2008

What does tiling vector data even mean? Well, I have wondered about the capabilities of the browser and the DOM to handle large vector datasets when they are uploaded to VirtualEarth. Infact, the Shape2VE project that I had undertaken was a direct result of that curiosity. When developing the Shape2VE application, I soon came to realize that once you exceed adding 300-400 shapes on to VirtualEarth, the performance starts degrading really fast and soon the application becomes unusable. Also, when adding large amounts of data to map, the browser stays unresponsive. Thus, I had to write Shape2VE so as to load the data asynchronously.

So, I was glad to know that Microsoft Research (the team that brought you MapCruncher) is striving to solve that same problem. They have released a TiledVectorsDemo application that attempts to solve this problem. They are utilizing a Python script to create tiles for the vector data which is in a GPX format. The Python offline preprocessor script works on the GPX data file which is about 2.5MB is size and chops it up into tiles and stored just like raster tiles. Unlike, raster tiles, the vector tiles are stored as JavaScript files containing first-class Javascript objects. The VirtualEarth application loads up only the tiles that are in the visible map area. And as the tiles go out of the visible extent of the map, they are deleted from VirtualEarth. Individual vector tiles are added to VirtualEarth as different layers. Since, the vector data is stored in vector tile files, they can be cached on the client so that they can be loaded faster if needed later. Pretty nifty I would say…

Can’t yet comment on the viability of this kind of technology for larger datasets, but it would be great to see this kind of technology be integrated with other technologies like GoogleGears and leverage its client-side database capabilities. But it certainly seems like a positive step in the right direction. I am kind of bummed that the script extracting vector tiles from GPX files is in Python and not in .NET…

Here is the TiledVectorsDemo.

And here is more information regarding the project.

View/Upload shapefile to VirtualEarth (Asynchronously)

Posted in Uncategorized by viswaug on January 21, 2008

I dug up this research project I did about 8 months ago to share with everyone who is interested in displaying their Shapefile(s) data in VirtualEarth. This web application is completely free to use (Free as in Beer!!!) as it has no dependencies on ESRI or any other expensive GIS libraries. This application actually uses the .NET wrapper (created by David Gancarz) for ShapeLib library from MapTools. I also use the JayRock library for JSON serialization of .NET types.

You should be able to run the project right after downloading it and see some of the sample datasets that I have included with the project. The web application can be downloaded here. The project which I am calling Shape2VE is also available through Assembla.

Here is a screenshot of the application before the shapefiles are displayed. In order to display the shapefiles, click on the ‘AddShapefile’ button.

CropperCapture[2]

Here is a screenshot after the shapefile has been uploaded.

CropperCapture[3]

Application Features:

  • The Shapefiles are uploaded asynchronously to VirtualEarth so that the user can use the web application during the upload and the map is still responsive.
  • Supports points, lines, and polygons.
  • The shapefile data is transferred to the browser in a JSON format so as to minimize payload.
  • Easily configurable. In order to configure the application to display your own shapefiles, modify the ‘OpenShapefile()’ function in ‘Default.aspx.cs’ to point to your own shapefiles.
    •     private void OpenShapefile()

          {

              veShapefileLoaderCollection loaders = new veShapefileLoaderCollection();

       

              loaders.Add(new vePolylineShapefileLoader(Request.PhysicalApplicationPath + “App_Data\\ftc\\onelnstr.shp”));

              loaders.Add(new vePolygonShapefileLoader(Request.PhysicalApplicationPath + “App_Data\\ftc\\natarea.shp”));

              loaders.Add(new vePointShapefileLoader(Request.PhysicalApplicationPath + “App_Data\\ftc\\addressSmall.shp”));

       

              Session[“Loaders”] = loaders;

              Session[“CurrentLoader”] = _currentLoader;

          }

  • Displays the attributes of the shapes from the shapefile when you mouse over the pushpins.

Notes:

  • The Shapefiles should be in WGS84 format.
  • The application currently only supports simple features and not multi-part features.

If you have any questions on the application please contact me using the ‘Contact Me’ link in the right-side pane.