Search code examples
dictionarymappingcloudmade

cloudmade - draggable marker + collecting the marker coordinates to be stored or used in the application


I would like to use CloudMade mapping in one of my projects. I need to be able to create a draggable marker so users can mark a certain geographic space on the map. I would also like to be able to save the coordinates of the marker in a database. Is that possible with CloudMade and how?


Solution

  • var centreIcon = new CM.Icon();
       centreIcon.image = "/images/marker_cross.png";
       centreIcon.iconSize = new CM.Size(15, 15);
       centreIcon.iconAnchor = new CM.Point(7.5, 7.5);
    
       newLocation = new CM.LatLng(gpsLat2, gpsLng2);
       centreMarker = new CM.Marker(newLocation,
       {
          title : "Centre", icon : centreIcon, draggable : true
       }
       );
       map.addOverlay(centreMarker);