ParcelStream ™ API

The ParcelStream™ API supports the addition of Parcel data, identify capabilities, query and geocoding into your mapping applications. These samples demonstrate the use of ParcelStream™ API on top of Microsoft Virtual Earth and Google Maps platforms.

Table of Contents

  1. Introduction

  2. Examples
  3. Getting Started
    Adding Layers
    Query and Identify
    Geocoding
    Advanced styling
    Example applications
    Client applications using ParcelStream™ today


Introduction

Include Javascript File

The URL in the example below (http://trial.parcelstream.com/DMPVE.aspx?key=abcdefg) is the location of a JavaScript file that includes code that you need for using the ParcelStream API. Your page must contain a script tag pointing to that URL, using the key you got when you signed up for the API. If your API key were "abcdefg", then your script tag might look like this:

MS Virtual Earth:

<script src="http://trial.parcelstream.com/DMPVE.aspx?key=abcdefg"type="text/javascript">

Google Maps:

<script src="http://trial.parcelstream.com/DMPAPI.aspx?key=abcdefg"type="text/javascript">


Examples

Each of the following examples shows only the relevant JavaScript code, not the full HTML file. You can plug the JavaScript code into the your HTML file, or you can download the full HTML file for each example by clicking the link after the example.

Supported Map API's

MS-Virtual Earth - Version 3 and later of the VE API is supported.

Google Maps - Version 2 and later of the Google Map API is supported

Add a Parcel Layer

MS Virtual Earth:

// Create the Virtual Earth Map Object
vemap = new VEMap('myMap');
vemap.SetDashboardSize(VEDashboardSize.Tiny);
vemap.LoadMap(new VELatLong(33.85, -117.8), 17 ,'a' ,false);

// Add DMPs PWS layer
AddDMPParcelLayer(vemap);

MS-Virtual Earth Sample

Sample with Two Maps

Google Maps:

// Create the Google Map Object
var map = new GMap2(document.getElementById('map'));
map.setCenter(new GLatLng(37.4419, -122.1419), 17);
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());

// Add a tiled parcel layer
var layers = ["Parcels"];
var tileLayer = new TiledLayer(map , layers);

 // Turn it on for zoom levels 16-20
 tileLayer.setMinZoomLevel(16);
 tileLayer.setMaxZoomLevel(20);
 tileLayer.initialize();

Google Maps Sample
 

Add a Parcel Labels Layer

The following example adds parcel labels to your map.

The following example adds a Non-Tiled (WMS) APN Label layer to your map and turns on the layer only from zoom level 14 - 18. This sample code is the same for MS-Virtual Earth and Google Maps

// Add parcel labels to zoom level 14-18 that are dynamically created.
function AddWMSLayer(map) {        
    var layers = ["ParcelLabels"];
    var mapLayer = new WMSLayer(map , layers); 
    mapLayer.setMinZoomLevel(14);
    mapLayer.setMaxZoomLevel(18);
    mapLayer.initialize();
}

// Add parcel labels to zoom level 19 that pre-placed using a tile layer 
function AddTiledLayer(map) {        
    var layers = ["ParcelLabels"];
    var mapLayer = new TiledLayer(map , layers); 
    mapLayer.setMinZoomLevel(19);
    mapLayer.setMaxZoomLevel(19);
    mapLayer.initialize();
 }

MS-Virtual Earth Sample

Google Maps Sample



Add Identify Capabilities

The following adds identify capabilities to your application. If an "On mouse click" event is on a property the API will return a record that contains a geometry. The geoemtry is then used to highlight the property on the map. To get a handle to the APN on identify look at the IdentifyObserver success method.

MS-Virtual Earth:

View code

MS-Virtual Earth Sample

Google Maps:

View code

Google Maps Sample





Rollover Identify of a Parcel

Move mouse on the Map to see identify on the fly.

MS-Virtual Earth Sample





Query on Map Extent

The following example performs a geometry query using the map extent, returning all parcels visible on the map, up to a maximum of 200.

MS-Virtual Earth:

View code

MS-Virtual Earth Sample

Google Maps:

View code

Google Maps Sample





Add External WMS Layer

The following example adds a Non-Tiled (WMS) layer to your map and turns on the layer for the specified zoom levels

function AddWMSLayer(layerName, minZoom, maxZoom) {
    
    var layers = ["Bathymetry","Topography","Countries"];
    mapLayer = new WMSLayer(vemap, layers, "http://www2.demis.nl/mapserver/request.asp"); 
    mapLayer.setProperty();
    
    mapLayer.setMinZoomLevel(minZoom);
    mapLayer.setMaxZoomLevel(maxZoom);
    mapLayer.setProperty("VMTVER", "1.0.0");
    mapLayer.setProperty("FORMAT", "image/png");
    mapLayer.initialize();
}

MS Virtual Earth:

MS-Virtual Earth Sample

Google Maps:

Google Maps Sample





Geocode Address

The following example geocodes an address

View code

View example (Geocode.html)





Add a Metadata Layer

The following example adds a Tiled Parcel Metadata layer to your map and changes the fill color to a 50% transparent red using a styled layer descriptor(SLD).

    function AddTiledLayer(minZoom, maxZoom, opacity) {
	var SLD = '<StyledLayerDescriptor version="1.0.0">';
	SLD+='<NamedLayer>';
	SLD+='<UserStyle>';
	SLD+='    <FeatureTypeStyle>';
	SLD+='<Rule>';
	SLD+='    <Filter>';
	SLD+='<PropertyIsGreaterThan>';
	SLD+='    <PropertyName>pcount</PropertyName>';
	SLD+='    <Literal>0</Literal>';
	SLD+='</PropertyIsGreaterThan>';
	SLD+='    </Filter>    ';
	SLD+='    <PolygonSymbolizer>';
	SLD+='    <Fill>    ';
	SLD+='        <CssParameter name="fill">#FF0000</CssParameter> ';
	SLD+='    </Fill>    ';
	SLD+='    </PolygonSymbolizer>    ';
	SLD+='</Rule>    ';
	SLD+='    </FeatureTypeStyle>    ';
	SLD+='</UserStyle>    ';
	SLD+='    </NamedLayer>';
	SLD+='</StyledLayerDescriptor>';

        var layers = ["ParcelMetadata"];
        tileLayer = new TiledLayer(map, layers); 
        tileLayer.setMinZoomLevel(1);
        tileLayer.setMaxZoomLevel(16);
        tileLayer.setOpacity(0.5);

        tileLayer.setStyleLayerDescriptorText(SLD);
        tileLayer.initialize();
    }

MS Virtual Earth:

MS-Virtual Earth Sample

Google Maps:

Google Maps Sample





Change Layer Display Properties with Styled Layer Descriptor (SLD) Text

The following example adds a Tiled APN Label layer to your map and changes the font-color to blue using a styled layer descriptor(SLD).

(Note: To ensure labels are displayed properly on a tiled layer, we recommend setting the label anchor point to the center.)

function AddTiledLayer(minZoom, maxZoom) {
  var SLD = '<StyledLayerDescriptor version="1.0.0">';
  SLD+='<NamedLayer>';
  SLD+='<UserStyle>';
  SLD+='	<FeatureTypeStyle>';
  SLD+='<Rule>';
  SLD+='	<TextSymbolizer>';
  SLD+='		<Label>APN</Label>';
  SLD+='		<Font>';
  SLD+='			<CssParameter name="font-family">tahoma</CssParameter>';
  SLD+='			<CssParameter name="font-size">8</CssParameter>';
  SLD+='		</Font>';
  SLD+='		<LabelPlacement>';
  SLD+='			<PointPlacement>';
  SLD+='				<AnchorPoint>';
  SLD+='					<AnchorPointX>0.5</AnchorPointX>';
  SLD+='					<AnchorPointY>0.5</AnchorPointY>';
  SLD+='				</AnchorPoint>';
  SLD+='			</PointPlacement>';
  SLD+='		</LabelPlacement>';
  SLD+='		<Fill>';
  SLD+='			<CssParameter name="fill">#0000FF</CssParameter>';
  SLD+='		</Fill>';
  SLD+='	</TextSymbolizer>';
  SLD+='</Rule>';
  SLD+='	</FeatureTypeStyle>';
  SLD+='</UserStyle>';
  SLD+='	</NamedLayer>';
  SLD+='</StyledLayerDescriptor>';    
	
    var layers = ["ParcelLabels"];
    tileLayer = new TiledLayer(map, layers); 
    tileLayer.setMinZoomLevel(15);
    tileLayer.setMaxZoomLevel(19);

    tileLayer.setStyleLayerDescriptorText(SLD);
    tileLayer.initialize();
}

MS Virtual Earth:

MS-Virtual Earth Sample

Google Maps:

Google Maps Sample





Change Layer Display Properties with Styled Layer Descriptor (SLD) Url

The following example adds a Tiled APN Label layer to your map and changes the font-color to blue using a styled layer descriptor(SLD).

(Note: To ensure labels are displayed properly on a tiled layer, we recommend setting the label anchor point to the center.)

function AddTiledLayer(minZoom, maxZoom) {
    var layers = ["ParcelLabels"];
    tileLayer = new TiledLayer(map, layers); 
    tileLayer.setMinZoomLevel(15);
    tileLayer.setMaxZoomLevel(19);

    tileLayer.setStyleLayerDescriptorUrl("http://parcelstream.com/SLD/APNLabelBlue.xml");
    tileLayer.initialize();
}

MS Virtual Earth:

MS-Virtual Earth Sample

Google Maps:

Google Maps Sample