Click here to Skip to main content
14,360,787 members

SharePoint

 
QuestionPPS analysis service connection issues Pin
Abhilashpanda1128-Mar-13 22:45
memberAbhilashpanda1128-Mar-13 22:45 
QuestionUpdatePanel inside Dropdownlist not Working on Selected Index changed Event Pin
balaji101021-Mar-13 3:13
memberbalaji101021-Mar-13 3:13 
QuestionHow to show multiples pushpins in one map using REST services from Maps Ajax Control 7.0 and SharePoint 2010 list? Pin
Member 990179120-Mar-13 9:32
memberMember 990179120-Mar-13 9:32 
Hi All,

I’m trying to make a map that get address data from a SharePoint 2010 list and add pushpins according to each address.

I’m using REST services from Maps Ajax Control 7.0 to transform locations into coordinates.

The map is working, but I think the code is not correct. There is a loop placed on “function GeocodeCallback(result)”, but I can’t understand why it is there. If I delete the loop code line, the map doesn’t show pushpins.

Please, someone could explain why I need the loop. If the loop is incorrect, please, show me how to fix it. I am not a programmer but I am learning to be one.

My code is posted below:

Thank you all for helping me.








var map = null;
var pinInfobox = null;
var query;
// InfoBox
var infoboxOptions = {
offset: new Microsoft.Maps.Point(0, 15),
visible: false
};

var mapOptions = {
credentials: "XXXXXXXXX",
center: new Microsoft.Maps.Location(47.609771, -122.2321543125),
zoom: 12,
mapTypeId: Microsoft.Maps.MapTypeId.road
}

jQuery(document).ready(function ($) {
GetMap();
});

function GetMap() {
// Initialize the map
map = new Microsoft.Maps.Map(document.getElementById("mapDiv"), mapOptions);
map.getCredentials(MakeGeocodeRequest);
}

function MakeGeocodeRequest(credentials) {
var listUrl = "http://intranet/Teste/_vti_bin/listdata.svc/Carona";

$.getJSON(listUrl, function (data) {
var count = 0;

$.each(data.d.results, function (i, item) {
alert(item.Address);
query = item.Address + " " + item.City + " " + item.State;

var geocodeRequest = "http://dev.virtualearth.net/REST/v1/Locations/" + query + "?output=json&jsonp=GeocodeCallback&key=" + credentials;

CallRestService(geocodeRequest);
});
});
}

function CallRestService(request) {
var script = document.createElement("script");
script.setAttribute("type", "text/javascript");
script.setAttribute("src", request);
document.body.appendChild(script);
}

function GeocodeCallback(result) {
alert("Found location: " + result.resourceSets[0].resources[0].name);

if (result &&
result.resourceSets &&
result.resourceSets.length > 0 &&
result.resourceSets[0].resources &&
result.resourceSets[0].resources.length > 0) {


// The loop
for (var i = 0; i < 1; i++) {

// Add a pushpin at the found location
var location = new Microsoft.Maps.Location(result.resourceSets[0].resources[0].point.coordinates[0], result.resourceSets[0].resources[0].point.coordinates[1]);
var pin = new Microsoft.Maps.Pushpin(location);

// Create the infobox for the pushpin
pinInfobox = new Microsoft.Maps.Infobox(pin.getLocation(), infoboxOptions);
pin.Title = "teste " + i; //usually title of the infobox
pin.Description = result.resourceSets[0].resources[0].name; //information you want to display in the infobox

// Add handler for the pushpin click event.
Microsoft.Maps.Events.addHandler(pin, 'click', displayInfobox);

// Hide the infobox when the map is moved.
Microsoft.Maps.Events.addHandler(map, 'viewchange', hideInfobox);

alert(i);

map.entities.push(pin);
map.entities.push(pinInfobox);
}
}
}

function displayInfobox(e) {
if (e.targetType == 'pushpin') {
pinInfobox.setLocation(e.target.getLocation());
pinInfobox.setOptions({ title: e.target.Title, description: e.target.Description, visible: true });
}
}

function hideInfobox(e) {
if (e.targetType == 'pushpin') {
pinInfobox.setOptions({ visible: false });
}
}


QuestionInfoPath form not loaded when i start workflow Pin
Honeyboy_2011-Mar-13 4:24
memberHoneyboy_2011-Mar-13 4:24 
QuestionPackage not deploying new list Pin
Aptiva Dave7-Mar-13 13:12
memberAptiva Dave7-Mar-13 13:12 
AnswerRe: Package not deploying new list Pin
Aptiva Dave7-Mar-13 13:38
memberAptiva Dave7-Mar-13 13:38 
QuestionProblwm when i add web part into site definition ? Pin
Honeyboy_205-Mar-13 1:52
memberHoneyboy_205-Mar-13 1:52 
AnswerRe: Problwm when i add web part into site definition ? Pin
Ingo5-Mar-13 2:06
memberIngo5-Mar-13 2:06 
GeneralRe: Problwm when i add web part into site definition ? Pin
Honeyboy_205-Mar-13 2:09
memberHoneyboy_205-Mar-13 2:09 
QuestionInfoPath form on Submit! Open as an Outlook email Message using C# Pin
lasertracs26-Feb-13 9:28
memberlasertracs26-Feb-13 9:28 
AnswerRe: InfoPath form on Submit! Open as an Outlook email Message using C# Pin
Ingo26-Feb-13 21:58
memberIngo26-Feb-13 21:58 
QuestionUpdating a content type with new column, but need to add the default value to existing items Pin
Aptiva Dave14-Feb-13 5:55
memberAptiva Dave14-Feb-13 5:55 
GeneralRe: Updating a content type with new column, but need to add the default value to existing items Pin
Ingo14-Feb-13 7:02
memberIngo14-Feb-13 7:02 
GeneralRe: Updating a content type with new column, but need to add the default value to existing items Pin
Aptiva Dave14-Feb-13 9:17
memberAptiva Dave14-Feb-13 9:17 
AnswerRe: Updating a content type with new column, but need to add the default value to existing items Pin
Ingo14-Feb-13 22:31
memberIngo14-Feb-13 22:31 
QuestionAccessing SharePoint information regarding specific documents Pin
muneebalikiyani13-Feb-13 19:04
membermuneebalikiyani13-Feb-13 19:04 
AnswerRe: Accessing SharePoint information regarding specific documents Pin
Ingo13-Feb-13 22:57
memberIngo13-Feb-13 22:57 
QuestionPopulating list columns in Sharepoint 2010 custom doc library Pin
Aptiva Dave10-Feb-13 8:15
memberAptiva Dave10-Feb-13 8:15 
AnswerRe: Populating list columns in Sharepoint 2010 custom doc library Pin
AnandSharmaUK20-Feb-13 1:27
memberAnandSharmaUK20-Feb-13 1:27 
QuestionSoftware and Hardware requirements for document shareing Pin
HemadriT7-Feb-13 8:24
memberHemadriT7-Feb-13 8:24 
AnswerRe: Software and Hardware requirements for document shareing Pin
Ingo10-Feb-13 22:10
memberIngo10-Feb-13 22:10 
QuestionDeleting Items in a SPListItemCollection Pin
Aptiva Dave31-Jan-13 6:05
memberAptiva Dave31-Jan-13 6:05 
AnswerRe: Deleting Items in a SPListItemCollection Pin
JimmyRopes7-Feb-13 2:39
professionalJimmyRopes7-Feb-13 2:39 
QuestionGetting an error when trying to upload a document Pin
JimmyRopes30-Jan-13 3:35
professionalJimmyRopes30-Jan-13 3:35 
AnswerRe: Getting an error when trying to upload a document Pin
Ingo30-Jan-13 3:50
memberIngo30-Jan-13 3:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.