Services
Geocoding
This is the process by which an address is located. Once constructed an instance of the Geocoder can be reused within an application.
function init() {
var map = new MapDS.Maps.Map( "map" );
var g = new MapDS.Maps.Geocoder();
var address = new MapDS.Address( null, null, "2065" );
// make call to server for geocode
g.getLocations( address, function(result) {
if (result.Code===1) {
// build a marker to represent the geocode
var m = new MapDS.Maps.Marker(
new MapDS.LatLng( result.Locations[0].Position.Latitude, result.Locations[0].Position.Longitude )
);
var html = '<p>';
html += ( result.Locations[0].AddressLine ? result.Locations[0].AddressLine + ', ' : '' );
html += ( result.Locations[0].Locality ? result.Locations[0].Locality + ', ' : '' );
html += ( result.Locations[0].PostalCode ? result.Locations[0].PostalCode + ', ' : '' );
html += ( result.Locations[0].Region ? result.Locations[0].Region + ', ' : '' );
html += ( result.Locations[0].Country ? result.Locations[0].Country : '' );
html += '</p>';
m.setPopupContent( html );
// add a marker for the geocode
map.addOverlay(m);
// zoom in to geocode
map.setCentre( m.getPoint(), 15 );
}
});
}
// load it up
window.onload = init;
View example
Directions
The ability to calculate directions between two or more points is available using the Directions object. If the object is created using a Map as the first arugment then a polyline will be drawn on the map. If the second parameter is set to an DOM element then a list of instructions will be displayed.
function init() {
var map = new MapDS.Maps.Map( "map" );
var d = new MapDS.Maps.Directions( map, 'directions' );
var waypoints = [];
waypoints.push( new MapDS.LatLng(-33.831958,151.186129) );
waypoints.push( new MapDS.LatLng(-33.739288,151.211439) );
d.buildFromWaypoints( waypoints );
}
window.onload = init;View example
Find
The QuickMap® Map control provides a method for performing a feature search by calling the MapData Sciences servers.
For testing, developers have access to a limited feature set of POIs (Points Of Interest). Talk to us to gain access to over 20 categories and 52,000 predefined "sets" of locations eg fast food outlets, ATM's, Schools.
function init() {
var map = new MapDS.Maps.Map( "map", { zoom:9, centre:new MapDS.LatLng( -33.82011, 151.211626 ) } );
// build find options, centre point and 2km radius
var fo = new MapDS.Maps.FindOptions( map.getCentre(), 2000 );
// make call to server for items
map.Find( fo, function(results) {
for (var i=0; i<results.features.length; i++) {
var m = new MapDS.Maps.Marker( results.features[i].position );
var html = '<ul>';
for ( var prop in results.features[i].properties ) {
html += ( results.features[i].properties[prop] ? '<li>'+prop+':'+results.features[i].properties[prop]+'</li>' : '' );
}
html += '</ul>';
m.setPopupContent( html );
map.addOverlay( m );
}
map.loadBestView();
});
}
window.onload = init;View example