Vishful thinking…

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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: