Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. SharePoint
  4. How to show multiples pushpins in one map using REST services from Maps Ajax Control 7.0 and SharePoint 2010 list?

How to show multiples pushpins in one map using REST services from Maps Ajax Control 7.0 and SharePoint 2010 list?

Scheduled Pinned Locked Moved SharePoint
javascriptjsoncsharpsharepointdatabase
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 9864094
    wrote on last edited by
    #1

    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].na</x-turndown>

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups