MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Virtual Earth API: Bulk Adding Pushpins to a Layer to Improve Performance

This is a discussion on Virtual Earth API: Bulk Adding Pushpins to a Layer to Improve Performance within the Virtual Earth Blogs forums, part of the Blogs category; One of the new features from the Virtual Earth v6 Map Control API is the ability to bulk add groups ...


Go Back   MapPoint Forums > Blogs > Virtual Earth Blogs

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read



Click here to register

Reply

 

LinkBack (1) Thread Tools Display Modes
  1 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 01-04-2008
Junior Member
Yellow Belt
 
Join Date: Jan 2008
Posts: 25
Virtual Earth API: Bulk Adding Pushpins to a Layer to Improve Performance

One of the new features from the Virtual Earth v6 Map Control API is the ability to bulk add groups of pushpins to the map in one step.  This improves performance when putting a large number of pushpins on the map since the HTML markup of the pushpins is serialized and inserted in the map in one operation.


Bulk adding pushpins to the map consists of 3 steps:



  1. Create an array of pushpins
  2. Create an empty shape layer and add it to the map
  3. Add the array of pushpins to the shape layer

For example:


1. Create an array with a large number of pushpins:



var center = map.GetCenter();

var shapes = new Array();
for (i=0 ; i < 150; ++i)
{
     var shape = new VEShape(VEShapeType.Pushpin, new VELatLong(center.Latitude + Math.random()*20 - 10, center.Longitude + Math.random()*20 - 10));
     shapes.push(shape);
}


2. Create an empty shape layer and add it to the map:



var shapeLayer = new VEShapeLayer();
map.AddShapeLayer(shapeLayer);


3. Add the array of pushpins to the shape layer:



shapeLayer.AddShape(shapes);


Here's a link to a working sample which adds pushpins to the map using the new bulk add approach.  It has a checkbox which allows you to turn off the bulk add and add the pushpins in the normal manner so you can compare the performance improvement between bulk add and the traditional approach.  The time to execute a bulk add operation tends to be about 1/2 the time of the traditional approach.



Virtual Earth API Bulk Add Pushpin Sample




More...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
adding, api, bulk, improve, layer, performance, pushpins, virtual earth


LinkBacks (?)
LinkBack to this Thread: http://www.mapforums.com/virtual-earth-api-bulk-adding-pushpins-layer-improve-performance-6960.html

Posted By For Type Date
Merging Multiple Routes - MapPoint Articles - MP2K Magazine This thread Refback 01-08-2008 03:05 PM

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Virtual Earth API: Adding KML or GeoRSS Layers to the Map Keith Kinnan's Weblog Virtual Earth Blogs 0 01-04-2008 09:27 AM
Layer switching in Virtual Earth Apps VE Team Virtual Earth Blogs 0 09-21-2007 06:22 PM
Deleting pushpins in bulk brianmcg MapPoint 2006/2009 Discussion 1 06-22-2006 01:08 PM
Improving the performance of generating pushpins Programmati kavehmb2000 MapPoint 2006/2009 Discussion 2 05-21-2006 05:48 AM
Adding a layer/image over a City Anonymous MapPoint 2006/2009 Discussion 2 11-22-2002 01:25 PM


All times are GMT -5. The time now is 01:18 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
MP2K Magazine
Visitor Map

Ski Deals
Book first-rate ski holidays from the leading travel brands at exceptionally competitive prices. Check out the latest range of ski deal online at Holiday Hypermarket.

Spain Weather
Check out Spain Weather - Travel Counsellors details information on Spain including, weather, flights and accommodation.

Canada Flights
Canada flights are great value flights when you visit dealchecker.co.uk first. Full of surprises, Canada is simply the most astonishingly beautiful country in the world.

Dominican Republic Holidays
Dominican Republic holidays have something to offer for everyone. From water sports, to sun bathing and more, enjoy a holiday there!

Turkey
Before booking a holiday to Turkey check out the ULookUBook travel guide. Find out about the rich culture in Turkey before you go there to help you to make the most of your holiday.

Compare flight prices
Travel.co.uk makes it easy for you to compare flight prices from hundreds of UK based travel companies.

Cheap Florida Holidays
You thought American holidays were expensive? No ways! Affordable holidays to Florida, only at On The Beach.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52