MM Map API

Initialize
Include MM Map API Create Map Object Demo  
Marker and User-defined Div
Create Marker Delete Marker Show Popup  
Create User-defined Div Delete User-defined Div Get Position of User-defined Div  
Map Manipulation
Resize Map Move to Location Get/Set Zoom Level Get/Set Map Mode
Set Map Attributes Custom Right-click Menu Set Right-click Menu Fix Navigation Key
Get Current Position Get Visible Area Border
Zoom Bar, Moving Pad and other Controls
showZoomBar hideZoomBar showVerticalZoomBar hideVerticalZoomBar
showMovingPad hideMovingPad setZoomBarPosition setVerticalZoomBarPosition
setMovingPadPosition showShortNotice    
Keyboard-related
Move Map When Double Clicked Enable Keyboard ShortCuts Set Key Focus At Maparea Enable Mouse Wheel
Custom Event Handlers
Mouse Move Handler Mouse Move Handler No Delay Mouse Down Handler Mouse Up Handler
Mouse Wheel Handler Resolution Changed Handler Map Mode Changed Handler Move To Handler
Controls
Add Controls Controls Handler Get Shapes Callback Functions
Show/Hide Module
Center Mark Scale Zoom Bar Mode Selector
Tag
Show Tag Clear Tags  
Longdo Events & Traffic cameras
Show Longdo Event Icons Show Traffic Cameras  
Search POIs
Javascript RESTful API (Search) RESTful API (Get Location's detail) Etc.
Reverse Geocoding (Get address from Latitude, Longitude)
Javascript RESTful API    
Get POI Nearby Location (Get POI Nearby Location from Latitude, Longitude)
RESTful API      
Etc.
Layer km/degree Appropriate Zoom user-defined getPOIs Function

 

 

MM Map API comes the Thailand map imageries from NuMAP called NuRasterMap. Usage of the MM Map API with this NuRasterMap is possible only under the condition specified in the MM Map API Term of Use.

You will need to register for a key to be used with your web URL, see more information about how to obtain the key.

For MM Route routing suggestion API reference, please visit MM Route API Reference.

For MM Line API and Data API reference, please visit MM Line API and Data API Reference.

More demos code are available at http://mapdemo.longdo.com/.

 

Initialize

Include MM Map API

Put this in the header (replace xxxxxxxxxxxxxx with the registered key):

<script type="text/javascript" src="http://mmmap15.longdo.com/mmmap/mmmap.php?key=xxxxxxxxxxxxxxx"></script>

Create Map Object

Specify a div, latitude, longitude, and zoom level. You need create a div to hold the map, e.g., mmmap_div, first and create a variable linking to it.

var mmmap_div = document.getElementById('my_map_div');
mmmap = new MMMap(mmmap_div, 13.767734, 100.5351375, 3);

You can also specify mapmode, e.g., 'icons', 'normal'; (without icons), 'gray' (gray-ish map), 'hydro'

mmmap = new MMMap(mmmap_div, 13.767734, 100.5351375, 3, 'normal');

Note that the given latatitude and longitude in MMMap constructor above can be overriden by the location-remembering feature using web browser cookie (i.e. user will see the same location if he/she revisits MM Map API pages). To avoid this, call the moveTo again.

mmmap.moveTo(13.767734, 100.5351375);

Demo

This is way too complicated. Could you just show me a working example?

Sure. Please visit our map demo site at http://mapdemo.longdo.com/. There are several examples, you can view HTML source code of each example to see how the APIs are used. Don't forget to replace the API key with yours one if you cut and paste those code to your files.

 

Marker and User-defined Div

Create Marker

var marker_id = mmmap.createMarker(13.7654, 100.538, 'Victory Monoment', '<font face=tahoma>
An important transportation hub of Bangkok.อนุสาวรีย์ชัยครับ</font>');

Note the return value is the marker id (integer). Later on, you can also modify the contents of the marker.

document.getElementById('marker_' + marker_id).detail += '<br><br><span style="cursor:pointer;text-decoration:underline"
    onclick="mmmap.deleteMarker(' + marker_id + ')">Delete</span>;

Delete Marker

marker_id = id of the marker you get as a return value of the call mmmap.createMarker(...) (see the previous section)

mmmap.deleteMarker(marker_id);

Show Popup

mmmap.showPopUp(lat, lon, title, content);

The width and height of the pop-up will be automatically determined based on the contents inside. Optionally popup parameters can be also given in case we want to hint the proper width and height.

var popup_params = {
    "link" : "http://longdo.com",
    "width" : 450, height: 400,
    "fixpopupsize" : true,
};
mmmap.showPopUp(lat, lon, title, content, popup_params);

Other possible attributes:

  • fixpopupsize - if set to true, the width and height will be exactly as given, otherwise they will be LESS THAN OR EQUAL to the given values
  • cancelmousedown - if set to true, mouse down event on the popup will NOT propagate further to the underlying map (default: false)
  • draggable - if set to true, the custom div will be draggable (default: false)

To close an open popup, use

mmmap.closeLocationDetailPopup();

See the demo at http://mapdemo.longdo.com/index-popupdemo.php

Create User-defined Div

var testdiv = document.createElement('div')
testdiv.style.border = '1px solid red';
testdiv.innerHTML = 'click me';
testdiv.onclick = testclick;
testdiv.latitude = 13.752016;
testdiv.longitude = 100.53059;
var customdiv_id = mmmap.drawCustomDiv(testdiv, 13.752016, 100.53059, 'HEY');

function testclick(){
    mmmap.showPopUp(this.latitude, this.longitude, 'what is this?', 'this is a pop-up');
}

Also you can draw a custom div only at some zoom level:

min_zoom = 3;
max_zoom = 10;
mmmap.drawCustomDivLevel(testdiv, 13.752016, 100.53059, 'HEY', min_zoom, max_zoom);

Or draw custom div together with add a pop-up

mmmap.drawCustomDivWithPopup(testdiv, 13.752016, 100.53059, 'what is this?', 'this is a pop-up');
mmmap.drawCustomDivLevelWithPopup(testdiv, 13.752016, 100.53059, 'what is this', min_zoom, max_zoom, 'this is a pop-up');

By default the center of the testdiv will be positioned at the given latitude and longitude. The center of the testdiv is defiend by its width/2 and height/2. In some cases you might want to specify these offsets, you can do so by:

var attributes = {
    "centerOffsetX" : "12px",
    "centerOffsetY" : "24px"
};
mmmap.drawCustomDiv(testdiv, 13.752016, 100.53059, 'HEY', attributes);

Other possible attributes:

  • cancelmousedown - if set to true, mouse down event on the popup will NOT propagate further to the underlying map (default: false)

Delete User-defined Div

customdiv_id = id of the custom div you get as a return value of the call mmmap.drawCustomDiv(...) (see the previous section)

mmmap.removeCustomDivs(markerimage.customdiv_id);

Or you can delete all custom divs:

mmmap.clearCustomDivs();

Get Position of User-defined Div

customdivholder_id = id of the custom div you get as a return value of the call mmmap.drawCustomDivHolder(...)

var mydiv = mmmap.getCustomDivHolder(customdivholder_id);
alert(mydiv.latitude + ', ' + mydiv.longitude);

 

Map Manipulation

Resize Map

mmmap.setSize(newwidth,newheight);
mmmap.rePaint();

MoveLocation

mmmap.moveTo(latitude, longitude);

Get/Set Zoom Level

mmmap.getZoom();
mmmap.setZoom(3);

Get/Set Map Mode

To change the base map layer, one can use the following functions.

mmmap.setMapMode('normal');
mmmap.setMapMode('hydro');
mmmap.getMapMode();

Available base layer map modes are: (subject to change)

  • icons, icons-en (สถานที่)
  • normal, normal-en (ถนน)
  • gray, gray-en (สถานที่ สีเทา)
  • gray+overlay, gray+overlay-en (จราจร)
  • politicalwhite, politicalwhite-en (เขตการปกครอง)
  • hydro (แหล่งน้ำ)
  • minimal (ว่างเปล่า (สีขาว))
  • iconstransp, iconstransp-en (สถานที่ แบบพื้นหลังโปร่งใส)
  • normaltransp, normaltransp-en (ถนน แบบพื้นหลังโปร่งใส)
  • hybrid_google (สถานที่ แบบพื้นหลังโปร่งใส ซ้อนบนภาพดาวเทียมของ Google Maps) ** Please refer to the Google Maps API Terms of Use, usage fee might be required.

For traffic overlay add '+overlay' after mode name e.g., gray+overlay, gray+overlay-en

Set Map Attributes

Set the opacity attribute of the base layer.

mmmap.setMapAttributes({ "opacity" : 0.65 });

Set the background color attribute of the map area.

mmmap.setMapAttributes({ "bgcolor" : "#FFFFFF" });

Or

mmmap.setMapAttributes({ "opacity" : 0.65, "bgcolor" : "#FFFFFF" });

Custom Right-click Menu

Define a function that will print the HTML content for the menu items and register it with mmmap.extraRightClickFunction.

function myExtraRightClickFunction() {
    var txt = '<br/><span id="add_location_text" style="font-family:loma,tahoma;font-size:9pt;cursor:pointer;' +
        'text-decoration:underline" onmousedown="alert(\'http://myweb/myurl?lat=' + mmmap.mouseCursorLat() +
        '&long=' + mmmap.mouseCursorLong() + '\');">My custom menu item</span>';
    return txt;
}

mmmap.extraRightClickFunction = myExtraRightClickFunction;

Set Right-click Menu

Define a function that will print the HTML content for the menu items. (Ignore default content)

function myRightClickFunction() {
    var txt = '<span id="add_location_text" style="font-family:loma,tahoma;font-size:9pt;cursor:pointer;' +
        'text-decoration:underline" onmousedown="alert(\'http://myweb/myurl?lat=' + mmmap.mouseCursorLat() +
        '&long=' + mmmap.mouseCursorLong() + '\');">My custom menu item</span>';
    return txt;
}

mmmap.setMyRightClickFunction(myRightClickFunction);

Fix Navigation Key

Cannot type "+", "-", "z", "x" in my search box. How do I fix?

This is because those keys' events are used for map navigation. One work around is to do something like this.

<input type=text name="searchfor" id="searchfor" size=14 onfocus="document.onkeydown='return true'"
    onblur="setKeyFocusAtMaparea()" onclick="document.onkeydown='return true'">

And setKeyFocusAtMaparea() should be something like:

function setKeyFocusAtMaparea() {
    document.onkeydown=kh.doKeyDown;
    mmmap.mapdiv.focus();
}

Get Current Position

mmmap.centerLat();
mmmap.centerLong();

Accessing the global variables "latitude" and "longitude" are depreciated

Get Visible Area Border

MMMap.getVisibleAreaBorder();

Return value is object of min/max position of map border in degree

{
  "minlatitude" : xxx,
  "maxlatitude" : xxx,
  "minlongitude" : xxx,
  "maxlongitude" : xxx
}

 

Zoom bar and moving pad

showZoomBar

mmmap.showZoomBar(); // show Longdo Map classic zoom bar

hideZoomBar

mmmap.hideZoomBar(); // hide Longdo Map classic zoom bar

showVerticalZoomBar

mmmap.showVerticalZoomBar(); // show Longdo Map zoom bar

hideVerticalZoomBar

mmmap.hideVerticalZoomBar(); // hide Longdo Map zoom bar

showMovingPad

mmmap.showMovingPad(); // show Longdo Map moving pad

hideMovingPad

mmmap.hideMovingPad(); // hide Longdo Map moving pad

setZoomBarPosition

mmmap.setZoomBarPosition(<value>);
// 'default' or  {"left":"10px", "top":"30px"} or {"bottom":"20px", "right":"10px"}

setVerticalZoomBarPosition

mmmap.setVerticalZoomBarPosition(<value>); 
// 'default' or  {"left":"10px", "top":"30px"} or {"bottom":"20px", "right":"10px"}

setMovingPadPosition

mmmap.setMovingPadPosition(<value>); 
// 'default' or  {"left":"10px", "top":"30px"} or {"bottom":"20px", "right":"10px"}

see http://mapdemo.longdo.com/index-zoombar.php

showShortNotice

mmmap.showShortNotice(<value>); 
// true or false
// true will set the lower left copyright notice to be the short one (can be used when the map div is very small)

 

 

Keyboard-related

Move Map When Double Clicked

mmmap.setMoveMapWhenDBLClicked(<boolean>);

Whether to move the map to center when the user double-clicked (default = true)

Enable Keyboard ShortCuts

mmmap.enableKeyboardShortCuts();

User can use keys like "+", "-", "z", "x", and arrow keys to control the map (to disable set document.onkeydown, onkeypress, onkeyup to something else...)

Set Key Focus At Maparea

mmmap.setKeyFocusAtMaparea();

To move the focus to the map so that the above enableKeyboardShortCuts will work

Enable Mouse Wheel

mmmap.enableMouseWheel();

Enable map zooming using mousewheel

 

Custom Event Handlers

Mouse Move Handler

mmmap.setMouseMoveHandler(f);

Set custom mousemove event handler (will be delayed with setTimeout for 100 ms)

Example

function f() {
    alert('Current location is ' + mmmap.centerLat() + ', ' + mmmap.centerLong());
};

mmmap.setMouseMoveHandler(f);

Mouse Move Handler No Delay

mmmap.setMouseMoveHandlerNoDelay(f);

Set custom mousemove event handler (run without delay)

 

Mouse Down Handler

mmmap.setMouseDownHandler(f);

Set custom mousedown event handler

Mouse Up Handler

mmmap.setMouseUpHandler(f);

Set custom mouseup event handler

Mouse Wheel Handler

mmmap.setMouseWheelHandler(f);

Set custom mousewheel event handler

Resolution Changed Handler

mmmap.setResolutionChangedHandler(f);

Set custom event handler for resolution changing event

Map Mode Changed Handler

mmmap.setMapModeChangedHandler(f);

Set custom event handler for map mode changing event

Move To Handler

mmmap.setMoveToHandler(f);

Set custom event handler for map moved event

 

Controls

Add Controls

Controls will be displayed at the top left corner of the maps.

var canvas= mmmap.addControl('canvas');
canvas.addButton('measure');
canvas.addButton('poly');
canvas.addButton('clear');
canvas.addButton('zoomarea');

see http://mapdemo.longdo.com/demo/index-getlineobjects2.php

Controls Handler

Set custom event handler for line/polygon.

var handler = {
	'onupdateshape' : function() { // when edit line's points
		// .. do something(); ..
	},
	'ondrawfinished' : function() { // when double click for stop drawing line
		// .. do something(); ..
	},
	'onclick' : function() { // when click on the shape
		// .. do something(); ..
	}
}
canvas.setLinesHandler(handler);

Get Shapes

Get all shapes drawn by user

canvas.getAllShapes();

Get last shape drawn by user

canvas.getLastShape();

see http://mapdemo.longdo.com/index-getlineobjects.php

Callback Functions

Callback functions when a shape is added

canvas.setAddShapeCallBack(function() {..} );

Callback functions when a shape is deleted

canvas.setDeleteShapeCallBack(function() {..} );

see http://mapdemo.longdo.com/index-getlineobjects.php

 

Show/Hide Module

Center Mark

mmmap.showCenterMark();
mmmap.hideCenterMark();

Scale

mmmap.showScale();
mmmap.hideScale();

Zoom Bar

mmmap.showZoomBar();
mmmap.hideZoomBar();

Mode Selector

mmmap.showModeSelector();
mmmap.hideModeSelector();

 

Tag

Show Tag

MM Map API allows displaying of Object-Of-Interests (OOI) from Longdo Map web site by using the mmmap.showOOITag() method

mmmap.showOOITag(tag);
mmmap.showOOITagWithShowLevel(tag, showlevel_min, showlevel_max, showlevel_label_min, showlevel_label_max);
mmmap.showOOITagWithShowLevelWithCustomIcon(tag, showlevel_min, showlevel_max, showlevel_label_min, showlevel_label_max,
    iconmode);

showlevel_*, 0 means default from DB

iconmode = '' means default (server-supplied), 'none' means no icon, otherwise an image location (URL) of custom icon

Examples:

mmmap.showOOITag('hospital');

Show OOIs of tag "hospital" at their default zoom levels

mmmap.showOOITagWithShowLevel('education',3,0,11,0);

Start showing OOIs of tag "education" from zoom level 3-End and their lables from zoom 11-End

Clear Tags

mmmap.clearAllOOITags();

Clear all OOI tags

 

Longdo Events & Traffic cameras

Show Longdo Event Icons

MM Map API allows displaying of Events from Longdo Event web site by using the mmmap.showEvents() method

mmmap.showEvents(event_type, showlevel_min, showlevel_max); 

event_type: "ttn" means show all active events from Longdo Event that added by traffic.thai.net, otherwise show all active events from Longdo Event

showlevel_min: start level for show all active events' icon.  (thailand map: default = 9, world map: default: 13)

showlevel_max: stop level for show all active events' icon.  (thailand map: default = 15, world map: default: 19)

Examples:

mmmap.showEvents();

Show all active events from Longdo Event.

mmmap.showEvents('ttn');

Show all active events from Longdo Event that added by traffic.thai.net.

Show Traffic Cameras

MM Map API allows displaying of Traffic Cameras from Longdo Traffic web site by using the mmmap.showTrafficCameras() method

mmmap.showTrafficCameras(showlevel_min, showlevel_max); 

showlevel_min: start level for show all traffic cameras' icon.  (Thailand map: default = 9, world map: default: 13)

showlevel_max: stop level for show all traffic cameras' icon.  (Thailand map: default = 15, world map: default: 19)

Examples:

mmmap.showTrafficCameras();

Start showing all traffic cameras from zoom level 9-15 (in Thailand map) / level 13-19 (in World map)

 

Search POIs

Javascript

MM Map API allows searching of Tag/POIs from Longdo Map web site by using this method

mmmap.getSearchResultObject(search, bookmark, latitude, longitude, var_name, callback, ds); 
  • search: The word for search POIs.
  • bookmark: Index of the first of search results.  (default: 0)
  • latitude, longitude: The results  taken near a given latitude and longitude
  • var_name: Name of variable that store the results (default: searchresult)
  • callback: Callback function when the results are returned
  • ds: POI type (default: select all types)
    • data2p - search for POIs from NuMap
    • data2r - search for road
    • data2a - search for subdistrict, district, province
    • data2 - search for POIs from NuMap, road, subdistrict, district, province
    • con - search for contributed POIs
    • tag - search for location tag

 

Examples:

function showFirstPOIName(result) {
   alert(result.data[0].name);
}

mmmap.getSearchResultObject("hotel", 0, 13.76887, 100.49342, "search_result", "showFirstPOIName(search_result)", "data2,con"); 

get locations that contain "hotel" word, nearby position 13.76887,100.49342. (for POIs from NuMap and contributed points only)

mmmap.getSearchResultObject("hotel", 0, 13.76887, 100.49342, "search_result", "showFirstPOIName(search_result)");

get locations that contain "hotel" word, nearby position 13.76887,100.49342. (all data type)

 

Return object:

({
	meta: {
		hasmore:true, start:0, end:19, keyword:"hotel"
	},
	data: [
		{
			objecttype: "poi",
			id:"00145064", 
			name:"โรงแรมเซิร์ฟ บีช",
			status:"STATUS=A",
			showlevel:"12",
			lat:"12.8960446577816",
			lng:"100.869849109296",
			name_en:"Surf Beach Hotel",
			tag:"tag: hotel, tag: โรงแรม",
			ooi_id:"A00145064",
			num_location_image:"0",
			num_location_event:"0",
			shortdesc:"ถนนเลียบหาดจอมเทียน ต.นาเกลือ อ.บางละมุง จ.ชลบุรี 20260",
			shortdesc_en:"Lieap Hat Chomtien Rd., Na Kluea, Bang La Mung, Chon Buri, 20260"
		},
                {
			objecttype: "poi",
			id:"10015527", 
			name:"Hotel Pullman Bangkok King Power",
			status:"STATUS=N",
			showlevel:"18",
			lat:"13.758670091629",
			lng:"100.537793040276",
			name_en:"Hotel Pullman Bangkok King Power",
			url:"http://www.thaibis.com/bangkok/accommodation/pullman-hotel",
			tag:""tag: accommodation, tag: austcham-member, tag: Food & Drink, tag: hotel, tag: hotel-5 star, tag: โรงแรม",
			ooi_id:"A10015527",
			num_location_image:"2",
			num_location_event:"1",
			shortdesc:"ซอยส่วนบุคคล, แขวงถนนพญาไท, เขตราชเทวี, กรุงเทพมหานคร 10400",
			shortdesc_en:"Thanon Phaya Thai, Ratchathewi, Bangkok 10400 (BTS station: Phaya Thai Exit (N4)) (directions in detail page)"
		 },
		...
		...
		...
	]
})

/*
meta:
  hasmore - true/false (have more results or not ?) 
  start - index of the first of search results
  end - index of the end of search results
  keyword - the word for search POIs
data:
  objecttype - poi(POIs), khet(District), road, tag, geom
  id - POI ID 
  name - name (TH)
  status - A(Approved), N(New/Not approved)
  showlevel - start level for show on map
  lat - latitude
  lng - longitude
  name_en - name (EN)
  url - location's web site
  tag - POI's tag
  ooi_id - OOI ID
  num_location_image - number of location's image(s)
  num_location_event - number of location's event(s)
*/

 

See: http://mapdemo.longdo.com/demo/index-example-code.php?file=get-search-result-object.html

 

RESTful API (Search)

Not just javascript, you can also get search location results via RESTful API. Here's a simple example for POIs search:

http://mmmap15.longdo.com/search/rpc-json.php?action=search&mode=json&key=xxxxxxxxxxxxxx&search=hotel&bookmark=0
&center_lat=12.896474&center_long=100.869217&var=sresult&callback=getsearch(sresult);&ds=con,data2
  • action: "search" (required)
  • mode: "json" (required)
  • key: MMMap API key (replace xxxxxxxxxxxxxx with the registered key) (required)
  • search: The word for search POIs. (required)
  • bookmark: Index of the first search results.  (default: 0) (optional)
  • center_lat, center_long: The results  taken near a given center_lat and center_long (required)
  • var: Name of variable that store the results (optional)
  • callback: Callback function when the results are returned (optional)
  • ds: POI type (default: select all types) (optional)
    • data2p - search for POIs from NuMap
    • data2r - search for road
    • data2a - search for subdistrict, district, province
    • data2 - search for POIs from NuMap, road, subdistrict, district, province
    • con - search for contributed POIs
    • tag - search for location tag

 

Return JSON Object:

sresult = {
	"meta" : {"hasmore" : true, "start" : 0, "end" : 19, "keyword" : "hotel" },
	"data" : [
		{
			"objecttype": "poi",
			"id":"00145064", 
			"name":"โรงแรมเซิร์ฟ บีช",
			"status":"STATUS=A",
			"showlevel":"12",
			"lat":"12.8960446577816",
			"lng":"100.869849109296",
			"name_en":"Surf Beach Hotel",
			"tag":"tag: hotel, tag: โรงแรม",
			"ooi_id":"A00145064",
			"num_location_image":"0",
			"num_location_event":"0",
			"shortdesc":"ถนนเลียบหาดจอมเทียน ต.นาเกลือ อ.บางละมุง จ.ชลบุรี 20260",
			"shortdesc_en":"Lieap Hat Chomtien Rd., Na Kluea, Bang La Mung, Chon Buri, 20260"
		},
                {
			"objecttype": "poi",
			"id":"10015527", 
			"name":"Hotel Pullman Bangkok King Power",
			"status":"STATUS=N",
			"showlevel":"18",
			"lat":"13.758670091629",
			"lng":"100.537793040276",
			"name_en":"Hotel Pullman Bangkok King Power",
			"url":"http://www.thaibis.com/bangkok/accommodation/pullman-hotel",
			"tag":""tag: accommodation, tag: austcham-member, tag: Food & Drink, tag: hotel, tag: hotel-5 star, tag: โรงแรม",
			"ooi_id":"A10015527",
			"num_location_image":"2",
			"num_location_event":"1",
			"shortdesc":"ซอยส่วนบุคคล, แขวงถนนพญาไท, เขตราชเทวี, กรุงเทพมหานคร 10400",
			"shortdesc_en":"Thanon Phaya Thai, Ratchathewi, Bangkok 10400 (BTS station: Phaya Thai Exit (N4)) (directions in detail page)"
		 },
		...
		...
		...
	]
};
getsearch(sresult);

/*
meta:
  hasmore - true/false (have more results or not ?) 
  start - index of the first of search results
  end - index of the end of search results
  keyword - the word for search POIs
data:
  objecttype - poi(POIs), khet(District), road, tag, geom
  id - POI ID 
  name - name (TH)
  status - A(Approved), N(New/Not approved)
  showlevel - start level for show on map
  lat - latitude
  lng - longitude
  name_en - name (EN)
  url - location's web site
  tag - POI's tag
  ooi_id - OOI ID
  num_location_image - number of location's image(s)
  num_location_event - number of location's event(s)
*/

 

RESTful API (Get Location's detail)

You can get location's details via RESTful API. Here's a simple example:

http://mmmap15.longdo.com/search/rpc-json.php?action=showpoidetails_json&mode=json&key=xxxxxxxxxxxxxx&id=A00145064&var=sresult&callback=showLocationDetails(sresult);
  • action: "showpoidetails_json" (required)
  • mode: "json" (required)
  • key: MMMap API key (replace xxxxxxxxxxxxxx with the registered key) (required)
  • id: OOI ID of location (required)
  • var: Name of variable that store the results (optional)
  • callback: Callback function when the results are returned (optional)

 

Return JSON Object #1:

sresult = { "id" : "A00000002", "name" : "ศาลากลางจังหวัดนครปฐม", "name_en" : "Nakhon Pathom City Hall Old", "description" : "", "description_en" : "", "description_text" : "", "description_en_text" : "", "short_desc" : "วงเวียน ต.พระปฐมเจดีย์ อ.เมืองนครปฐม จ.นครปฐม 73000", "short_desc_en" : "Roundabout, Phra Pathom Chedi, Muang Nakhon Prathom, Nakhon Pathom, 73000", "shortdescription_html" : "<a href=http://map.longdo.com/p/A00000002/map target=_blank alt='map'><img title='แสดง URL สำหรับเชื่อมโยงมาสถานที่นี้ (ดูที่ address bar)' src='http://mmmap15.longdo.com/mmmap//images/button/link_th.png' onmouseover='this.src="http://mmmap15.longdo.com/mmmap//images/button/link2_th.png"' onmouseout='this.src="http://mmmap15.longdo.com/mmmap//images/button/link_th.png"' border=0></a> <a href=http://map.longdo.com/p/A00000002 target=_blank alt='detail'><img title='ดูรายละเอียดของสถานที่นี้' src='http://mmmap15.longdo.com/mmmap//images/button/detail_th.png' onmouseover='this.src="http://mmmap15.longdo.com/mmmap//images/button/detail2_th.png"' onmouseout='this.src="http://mmmap15.longdo.com/mmmap//images/button/detail_th.png"' border=0></a> <a href=http://map.longdo.com/createlink?doit=1&poi=A00000002 target=_blank alt='snippet'><img title='สร้าง snippet สถานที่นี้ เพื่อนำไปแปะในเว็บไซต์ของท่าน' src='http://mmmap15.longdo.com/mmmap//images/button/snippet.png' onmouseover='this.src="http://mmmap15.longdo.com/mmmap//images/button/snippet2.png"' onmouseout='this.src="http://mmmap15.longdo.com/mmmap//images/button/snippet.png"' border=0></a><br>วงเวียน ต.พระปฐมเจดีย์ อ.เมืองนครปฐม จ.นครปฐม 73000", "shortdescription_en_html" : "<a href=http://map.longdo.com/p/A00000002/map target=_blank alt='map'><img title='URL link to this location in Longdo Map' src='http://mmmap15.longdo.com/mmmap//images/button/link.png' onmouseover='this.src="http://mmmap15.longdo.com/mmmap//images/button/link2.png"' onmouseout='this.src="http://mmmap15.longdo.com/mmmap//images/button/link.png"' border=0></a> <a href=http://map.longdo.com/p/A00000002 target=_blank alt='detail'><img title='View detail of this location' src='http://mmmap15.longdo.com/mmmap//images/button/detail.png' onmouseover='this.src="http://mmmap15.longdo.com/mmmap//images/button/detail2.png"' onmouseout='this.src="http://mmmap15.longdo.com/mmmap//images/button/detail.png"' border=0></a> <a href=http://map.longdo.com/createlink?doit=1&poi=A00000002 target=_blank alt='snippet'><img title='Create Map Snippet for this location for using in my web page' src='http://mmmap15.longdo.com/mmmap//images/button/snippet.png' onmouseover='this.src="http://mmmap15.longdo.com/mmmap//images/button/snippet2.png"' onmouseout='this.src="http://mmmap15.longdo.com/mmmap//images/button/snippet.png"' border=0></a><br>Roundabout, Phra Pathom Chedi, Muang Nakhon Prathom, Nakhon Pathom, 73000", "telephone" : "", "web" : "", "iconfile" : "http://mmmap15.longdo.com/mmmap/images/icons/government-office2.png", "status" : "Approved", "private" : "false", "lastupdate" : "2011-12-28 21:26:28", "showlevel" : "15", "stopshowlevel" : "20", "image_related_html" : "", "image_related_html_en" : "", "tag" : "government_office, สถานที่ราชการ", "mapurl" : "http://map.longdo.com/p/A00000002/map", "contributed_by" : "admin", "comment_count" : 0, "pname" : "", "pname_en" : "", "pid" : "-1" }; showLocationDetails(sresult);

Return JSON Object #2:

sresult = { "id" : "A00145064", "name" : "โรงแรมเซิร์ฟ บีช", "name_en" : "Surf Beach Hotel", "description" : "", "description_en" : "", "description_text" : "", "description_en_text" : "", "short_desc" : "ถนนเลียบหาดจอมเทียน ต.นาเกลือ อ.บางละมุง จ.ชลบุรี 20260", "short_desc_en" : "Lieap Hat Chomtien Rd., Na Kluea, Bang La Mung, Chon Buri, 20260", "shortdescription_html" : "<a href=http://map.longdo.com/p/A00145064/map target=_blank alt='map'><img title='แสดง URL สำหรับเชื่อมโยงมาสถานที่นี้ (ดูที่ address bar)' src='http://mmmap15.longdo.com/mmmap//images/button/link_th.png' onmouseover='this.src=\"http://mmmap15.longdo.com/mmmap//images/button/link2_th.png\"' onmouseout='this.src=\"http://mmmap15.longdo.com/mmmap//images/button/link_th.png\"' border=0></a> <a href=http://map.longdo.com/p/A00145064 target=_blank alt='detail'><img title='ดูรายละเอียดของสถานที่นี้' src='http://mmmap15.longdo.com/mmmap//images/button/detail_th.png' onmouseover='this.src=\"http://mmmap15.longdo.com/mmmap//images/button/detail2_th.png\"' onmouseout='this.src=\"http://mmmap15.longdo.com/mmmap//images/button/detail_th.png\"' border=0></a> <a href=http://map.longdo.com/createlink?doit=1&poi=A00145064 target=_blank alt='snippet'><img title='สร้าง snippet สถานที่นี้ เพื่อนำไปแปะในเว็บไซต์ของท่าน' src='http://mmmap15.longdo.com/mmmap//images/button/snippet.png' onmouseover='this.src=\"http://mmmap15.longdo.com/mmmap//images/button/snippet2.png\"' onmouseout='this.src=\"http://mmmap15.longdo.com/mmmap//images/button/snippet.png\"' border=0></a><br>ถนนเลียบหาดจอมเทียน ต.นาเกลือ อ.บางละมุง จ.ชลบุรี 20260", "shortdescription_en_html" : "<a href=http://map.longdo.com/p/A00145064/map target=_blank alt='map'><img title='URL link to this location in Longdo Map' src='http://mmmap15.longdo.com/mmmap//images/button/link.png' onmouseover='this.src=\"http://mmmap15.longdo.com/mmmap//images/button/link2.png\"' onmouseout='this.src=\"http://mmmap15.longdo.com/mmmap//images/button/link.png\"' border=0></a> <a href=http://map.longdo.com/p/A00145064 target=_blank alt='detail'><img title='View detail of this location' src='http://mmmap15.longdo.com/mmmap//images/button/detail.png' onmouseover='this.src=\"http://mmmap15.longdo.com/mmmap//images/button/detail2.png\"' onmouseout='this.src=\"http://mmmap15.longdo.com/mmmap//images/button/detail.png\"' border=0></a> <a href=http://map.longdo.com/createlink?doit=1&poi=A00145064 target=_blank alt='snippet'><img title='Create Map Snippet for this location for using in my web page' src='http://mmmap15.longdo.com/mmmap//images/button/snippet.png' onmouseover='this.src=\"http://mmmap15.longdo.com/mmmap//images/button/snippet2.png\"' onmouseout='this.src=\"http://mmmap15.longdo.com/mmmap//images/button/snippet.png\"' border=0></a><br>Lieap Hat Chomtien Rd., Na Kluea, Bang La Mung, Chon Buri, 20260", "telephone" : "", "web" : "", "iconfile" : "http://mmmap15.longdo.com/mmmap/images/icons/hotel.png", "status" : "Approved", "private" : "false", "lastupdate" : "2011-12-29 15:32:04", "showlevel" : "16", "stopshowlevel" : "20", "image_related_html" : "", "image_related_html_en" : "", "tag" : "hotel, โรงแรม", "mapurl" : "http://map.longdo.com/p/A00145064/map", "contributed_by" : "admin", "comment_count" : 0, "pname" : "", "pname_en" : "", "pid" : "-1" }; showLocationDetails(sresult);

Return JSON Object #3:

sresult = { "id" : "A10001545", "name" : "สยามโอเชียนเวิลด์", "name_en" : "Siam Ocean World", "description" : "<br /><p class="pagetitle"><a href="http://www.austchamthailand.com/atcc/asp/" title="AustChamThailand Home Page"><img src="http://www.austchamthailand.com/atcc/commonfiles/css/images/atcc_logo_310x29.png" alt="AustChamThailand Home Page" width="310" height="29" /></a></p><p class="pagetitle"><a href="http://www.siamoceanworld.com/" target="openURL"><img src="http://www.austchamthailand.com/asp/displogo.asp?CorpID=1022" border="0" alt="Siam Ocean World Bangkok Company Limited" width="150" height="160" /></a></p><p><strong>Siam Ocean World Bangkok Company Limited</strong></p><table border="0" cellspacing="0" cellpadding="0"><tbody><tr><td class="tabletext">Address: </td><td class="tabletext">B1-B2 Floor, Siam Paragon Complex<br />991 Rama 1 Road, Pathumwan</td></tr><tr><td class="tabletext">City: </td><td class="tabletext">Bangkok</td></tr><tr><td class="tabletext">Post Code: </td><td class="tabletext">10330</td></tr><tr><td class="tabletext">Country: </td><td class="tabletext">Thailand </td></tr><tr><td class="tabletext">Phone Number: </td><td class="tabletext"><span class="skype_pnh_print_container">+66 2 687 2000</span><span class="skype_pnh_container"><strong><font size="2"><font color="#49535a"><font face="Tahoma"><span class="skype_pnh_mark"> </span></font></font></font></strong></span></td></tr><tr><td class="tabletext">Fax Number: </td><td class="tabletext">+66 2 687 2001</td></tr><tr><td class="tabletext">General Email: </td><td class="tabletext">golson@siamoceanworld.com</td></tr><tr><td class="tabletext">URL: </td><td class="tabletext">www.siamoceanworld.com</td></tr><tr><td class="tabletext">Primary Business Activity: </td><td class="tabletext">Tourism Service</td></tr><tr><td class="tabletext">Additional Business Activity: </td><td class="tabletext">Education</td></tr></tbody></table><table border="0" cellspacing="0" cellpadding="0"><tbody><tr><td class="tabletext"><a href="http://www.austchamthailand.com/ATCC/asp/memblist.asp?SponsorID=0&CorpID=1022" title="Show People"><img src="http://www.austchamthailand.com/commonfiles/images/members.gif" border="0" alt="Show People" width="23" height="16" align="bottom" /></a> <a href="http://www.austchamthailand.com/ATCC/asp/memblist.asp?SponsorID=0&CorpID=1022" title="Show People"><u><font color="#0000ff">Show People</font></u></a></td></tr><tr><td> </td></tr><tr><td><strong>Background</strong></td></tr><tr><td class="tabletext" colspan="2">Siam Ocean World Bangkok was established by Oceanis Australia Group, the world's largest aquarium owner and operator with more than 17 years experience in the aquarium business. Siam Ocean World Bangkok is Thailand's first world-class aquarium with an integrated state-of-the-art 4D theatre.<br /><br />Siam Ocean World is located on B1 and B2 Floors of Siam Paragon Shopping Complex at Siam BTS skytrain station and is open daily from 10.00-21.00 hrs.<br /></td></tr><tr><td> </td></tr><tr><td><strong>Products or Services</strong></td></tr><tr><td class="tabletext" colspan="2">* Tourist attraction for locals, expats and foreigners<br />* Education programs for school children<br />* Glass Bottom Boat ride & Back of House Tour<br />* 4D Theatre<br />* 5 Star Functions venue<br />* Dive with the Sharks & Ocean Walker<br />* Shark Encounter<br />* Happy Fish Happy Feet<br /></td></tr></tbody></table><br /><table border="0"><tbody><tr><td style="border-width: 1px; border-color: #ccff99; border-style: solid"> <a href="https://picasaweb.google.com/lh/view?q=Siam%20ocean%20world&uname=auswathai&psc=F&cuname=auswathai#5634338756195187170" target="_blank"><img src="https://lh3.googleusercontent.com/-PtWU8JojMa4/TjExPys6-eI/AAAAAAAAnYg/EY3ycVmUS6E/s640/Siam%252520Ocean%252520World%252520Bangkok%252520Thailand.jpg" alt="" width="640" height="480" /></a></td><td><p>Photo Collage</p><p>to expand click </p><p>on image or <a href="https://picasaweb.google.com/lh/view?q=Siam%20ocean%20world&uname=auswathai&psc=F&cuname=auswathai#5634338756195187170" target="_blank"><u><font color="#0000ff">click here</font></u></a></p></td></tr><tr><td><p><a href="http://www.thaibis.com/bkk/soi-19-sukhumvit" target="_blank"><u><font color="#0000ff">Sukhumvit Soi 19 Hospitality</font></u></a> or <a href="http://www.thaibis.com/longdo-tourism-bangkok" target="_blank"><u><font color="#0000ff">Tourism Bangkok - zones - venues - transport</font></u></a></p></td><td> </td></tr></tbody></table", "description_en" : "<br /><table border="0"><tbody><tr><td style="border-width: 1px; border-color: #ccff99; border-style: solid"> <a href="https://picasaweb.google.com/lh/view?q=Siam%20ocean%20world&uname=auswathai&psc=F&cuname=auswathai#5634338756195187170" target="_blank"><img src="https://lh3.googleusercontent.com/-PtWU8JojMa4/TjExPys6-eI/AAAAAAAAnYg/EY3ycVmUS6E/s640/Siam%252520Ocean%252520World%252520Bangkok%252520Thailand.jpg" alt="" width="640" height="480" /></a></td><td><p>Photo Collage</p><p>to expand click </p><p>on image or <a href="https://picasaweb.google.com/lh/view?q=Siam%20ocean%20world&uname=auswathai&psc=F&cuname=auswathai#5634338756195187170" target="_blank">click here</a></p></td></tr><tr><td><p><span style="font-family: Helvetica, sans-serif, Verdana, Tahoma, Arial; font-size: 13px" class="Apple-style-span"><span style="background-color: #fffdf5" class="Apple-style-span"><span style="color: #7c5a31; background-color: #fffdf5" class="Apple-style-span"><table border="0" style="border-collapse: separate"><tbody><tr><td colspan="2"><p><span style="line-height: 16px; font-family: Helvetica, Arial, Verdana, sans-serif; color: #ff9900; font-size: small" class="Apple-style-span"><font color="#666666"><font><font style="background-color: #c9d7f1; -webkit-box-shadow: #9999aa 2px 2px 4px; box-shadow: #9999aa 2px 2px 4px; box-sizing: border-box; position: relative" class="goog-text-highlight">Map tricks. </font></font></font></span><span style="line-height: 16px; font-family: Helvetica, Arial, Verdana, sans-serif; color: #ff9900; font-size: small" class="Apple-style-span"><font color="#666666"><font><font style="background-color: #c9d7f1; -webkit-box-shadow: #9999aa 2px 2px 4px; box-shadow: #9999aa 2px 2px 4px; box-sizing: border-box; position: relative" class="goog-text-highlight">@. </font></font></font><span style="font-size: 13px"><font size="2" style="color: #666666"><font><font style="background-color: #c9d7f1; -webkit-box-shadow: #9999aa 2px 2px 4px; box-shadow: #9999aa 2px 2px 4px; box-sizing: border-box; position: relative" class="goog-text-highlight">Location Map (. </font></font></font><strong><font size="3" color="#ff0000"><font><font style="background-color: #c9d7f1; -webkit-box-shadow: #9999aa 2px 2px 4px; box-shadow: #9999aa 2px 2px 4px; box-sizing: border-box; position: relative" class="goog-text-highlight">+.</font></font></font></strong><font size="2" style="color: #666666"><font><font style="background-color: #c9d7f1; -webkit-box-shadow: #9999aa 2px 2px 4px; box-shadow: #9999aa 2px 2px 4px; box-sizing: border-box; position: relative" class="goog-text-highlight"> Map Centre) Type "Transport", see Best Search words. </font></font></font></span></span><span style="line-height: 16px; font-family: Helvetica, Arial, Verdana, sans-serif; color: #ff9900; font-size: 13px" class="Apple-style-span"><font size="2" style="color: #666666"><font><font style="background-color: #c9d7f1; -webkit-box-shadow: #9999aa 2px 2px 4px; box-shadow: #9999aa 2px 2px 4px; box-sizing: border-box; position: relative" class="goog-text-highlight"> at. </font></font></font><a style="text-decoration: underline; color: #666666; font-size: small" href="http://www.thaibis.com/longdo-tourism-bangkok/visitors-welcome/hospitality" target="_blank"><font><font style="background-color: #c9d7f1; -webkit-box-shadow: #9999aa 2px 2px 4px; box-shadow: #9999aa 2px 2px 4px; box-sizing: border-box; position: relative" class="goog-text-highlight">Longdo Map Hospitality.</font></font></a></span></p></td></tr></tbody></table></span></span></span></p><p><span style="color: #666666; font-family: Helvetica, Arial, Verdana, sans-serif; background-color: #fffdf5; font-size: small" class="Apple-style-span"><span style="line-height: 20px" class="Apple-style-span"><font><font>Map links & tips: Land <> Water. </font></font></span><a style="text-decoration: underline; color: #339999; line-height: 20px; cursor: text" href="http://www.thaibis.com/longdo-tourism-bangkok/visitors-welcome/transport" target="_blank"><font><font>Transport Bangkok stations.</font></font></a></span> </p><p> </p></td><td> </td></tr></tbody></table>", "description_text" : "Siam Ocean World Bangkok Company LimitedAddress: B1-B2 Floor, Siam Paragon Complex991 Rama 1 Road, PathumwanCity: BangkokPost Code: 10330Country: Thailand Phone Number: +66 2 687 2000 Fax Number: +66 2 687 2001General Email: golson@siamoceanworld.comURL: www.siamoceanworld.comPrimary Business Activity: Tourism ServiceAdditional Business Activity: Education Show People BackgroundSiam Ocean World Bangkok was established by Oceanis Australia Group, the world's largest aquarium owner and operator with more than 17 years experience in the aquarium business. Siam Ocean World Bangkok is Thailand's first world-class aquarium with an integrated state-of-the-art 4D theatre.Siam Ocean World is located on B1 and B2 Floors of Siam Paragon Shopping Complex at Siam BTS skytrain station and is open daily from 10.00-21.00 hrs. Products or Services* Tourist attraction for locals, expats and foreigners* Education programs for school children* Glass Bottom Boat ride & Back of House Tour* 4D Theatre* 5 Star Functions venue* Dive with the Sharks & Ocean Walker* Shark Encounter* Happy Fish Happy Feet Photo Collageto expand click on image or click hereSukhumvit Soi 19 Hospitality or Tourism Bangkok - zones - venues - transport ", "description_en_text" : " Photo Collageto expand click on image or click hereMap tricks. @. Location Map (. +. Map Centre) Type "Transport", see Best Search words. at. Longdo Map Hospitality.Map links & tips: Land Water. Transport Bangkok stations.", "short_desc" : "อควาเรียม โลกใต้น้ำชั้นใต้ดิน สยามพารากอน", "short_desc_en" : "Rama 1 Rd., Pathum Wan, Patumwan, Bangkok, 10400", "shortdescription_html" : "<a href=http://www.thaibis.com/bangkok/attractions/ocean-world target=_blank alt='www'><img title='ไปยังเว็บไซต์ของสถานที่นี้' src='http://mmmap15.longdo.com/mmmap//images/button/www_th.png' onmouseover='this.src="http://mmmap15.longdo.com/mmmap//images/button/www2_th.png"' onmouseout='this.src="http://mmmap15.longdo.com/mmmap//images/button/www_th.png"' border=0></a> <a href=http://map.longdo.com/p/A10001545/map target=_blank alt='map'><img title='แสดง URL สำหรับเชื่อมโยงมาสถานที่นี้ (ดูที่ address bar)' src='http://mmmap15.longdo.com/mmmap//images/button/link_th.png' onmouseover='this.src="http://mmmap15.longdo.com/mmmap//images/button/link2_th.png"' onmouseout='this.src="http://mmmap15.longdo.com/mmmap//images/button/link_th.png"' border=0></a> <a href=http://map.longdo.com/p/A10001545 target=_blank alt='detail'><img title='ดูรายละเอียดของสถานที่นี้' src='http://mmmap15.longdo.com/mmmap//images/button/detail_th.png' onmouseover='this.src="http://mmmap15.longdo.com/mmmap//images/button/detail2_th.png"' onmouseout='this.src="http://mmmap15.longdo.com/mmmap//images/button/detail_th.png"' border=0></a> <a href=http://map.longdo.com/createlink?doit=1&poi=A10001545 target=_blank alt='snippet'><img title='สร้าง snippet สถานที่นี้ เพื่อนำไปแปะในเว็บไซต์ของท่าน' src='http://mmmap15.longdo.com/mmmap//images/button/snippet.png' onmouseover='this.src="http://mmmap15.longdo.com/mmmap//images/button/snippet2.png"' onmouseout='this.src="http://mmmap15.longdo.com/mmmap//images/button/snippet.png"' border=0></a><br>อควาเรียม โลกใต้น้ำชั้นใต้ดิน สยามพารากอน", "shortdescription_en_html" : "<a href=http://www.thaibis.com/bangkok/attractions/ocean-world target=_blank alt='www'><img title='Browse to its web site' src='http://mmmap15.longdo.com/mmmap//images/button/www.png' onmouseover='this.src="http://mmmap15.longdo.com/mmmap//images/button/www2.png"' onmouseout='this.src="http://mmmap15.longdo.com/mmmap//images/button/www.png"' border=0></a> <a href=http://map.longdo.com/p/A10001545/map target=_blank alt='map'><img title='URL link to this location in Longdo Map' src='http://mmmap15.longdo.com/mmmap//images/button/link.png' onmouseover='this.src="http://mmmap15.longdo.com/mmmap//images/button/link2.png"' onmouseout='this.src="http://mmmap15.longdo.com/mmmap//images/button/link.png"' border=0></a> <a href=http://map.longdo.com/p/A10001545 target=_blank alt='detail'><img title='View detail of this location' src='http://mmmap15.longdo.com/mmmap//images/button/detail.png' onmouseover='this.src="http://mmmap15.longdo.com/mmmap//images/button/detail2.png"' onmouseout='this.src="http://mmmap15.longdo.com/mmmap//images/button/detail.png"' border=0></a> <a href=http://map.longdo.com/createlink?doit=1&poi=A10001545 target=_blank alt='snippet'><img title='Create Map Snippet for this location for using in my web page' src='http://mmmap15.longdo.com/mmmap//images/button/snippet.png' onmouseover='this.src="http://mmmap15.longdo.com/mmmap//images/button/snippet2.png"' onmouseout='this.src="http://mmmap15.longdo.com/mmmap//images/button/snippet.png"' border=0></a><br>Rama 1 Rd., Pathum Wan, Patumwan, Bangkok, 10400", "telephone" : "", "web" : "http://www.thaibis.com/bangkok/attractions/ocean-world", "iconfile" : "http://mmmap15.longdo.com/mmmap/images/icons/travel.png", "status" : "Approved", "private" : "false", "lastupdate" : "2011-12-28 21:25:04", "showlevel" : "16", "stopshowlevel" : "20", "image_related_html" : "<img src='http://map.longdo.com/files/images/2010/11/08/20101108150356_46292'>", "image_related_html_en" : "<img src='http://map.longdo.com/files/images/2010/11/08/20101108150356_46292'>", "tag" : "attractions, austcham-member, cibgrp, marine life, Siam Tour code:mvfff, tour zone Siam-F, Tour-popular, travel, venue 5 star, zoo, ท่องเที่ยว", "mapurl" : "http://map.longdo.com/p/A10001545/map", "contributed_by" : "pattara", "comment_count" : 2, "pname" : "ห้างสรรพสินค้าสยามพารากอน", "pname_en" : "Siam Paragon", "pid" : "A00132349" }; showLocationDetails(sresult); /* id - POI ID name - name (TH) name_en - name (EN) description - location's description (TH) (HTML) description_en - location's description (EN) (HTML) description_en_text - location's description (EN) (Plain text) description_en_text - location's description (EN) Plain text) short_desc - location's address (TH) short_desc_en - location's address (EN) shortdescription_html - short description (TH) (HTML) shortdescription_en_html - short description (EN) (HTML) telephone - location's telephone number web - location's web site iconfile - icon image status - location's status (Approved / New) private - location is private (True / False) lastupdate - Last update time showlevel - start zoom level stopshowlevel - stop zoom level image_related_html - location's images (TH) (HTML) image_related_html_en - location's images (EN) (HTML) tag - Location's tags mapurl - Longdo map URL contributed_by - Contributor comment_count - number of location's comments pname - Name of parent location pid - POI ID of parent location */

 

Etc.

See: http://mapdemo.longdo.com/demo/index-full.php

 

Reverse Geocoding

Javascript

  1. MM Map API allows get address object from latitude, longitude by using this method
mmmap.getAddressObjectFromLatLon(latitude, longitude, language, variable_name, callback_fn); 
  • latitude
  • longitude
  • language: Locale code
    • en - for get address info in English
    • th - for get address info in Thai
  • variable_name: Name of variable that store the results (required)
  • callback_fn: Callback function (string format) when the results are returned (required)

Return Address Object:

{

"province" : xxx, // Province name
"amphoe" : xxx, // District name
"district" : xxx, // Subdistrict name
"postcode" : xxx, // Post Code
"road" : xxx, // Road name
"soi" : xxx, // Lane name
"geocode" : xxx // Geocode
}

 

Examples:

function generateAddresToText(address) {
  if(!address.province) address.province = "-";
  if(!address.amphoe) address.amphoe = "-";
  if(!address.district) address.district = "-";
  if(!address.postcode) address.postcode = "-";
  if(!address.road) address.road = "-";
  if(!address.soi) address.soi = "-";

  alert("Province: " + address.province + "\n" +
    "District: " + address.amphoe + "\n" +
    "Subdistrict: " + address.district + "\n" +
    "Postcode: " + address.postcode + "\n" +
    "Road: " + address.road + "\n" +
    "Soi: " + address.soi + "\n" +
    "Geocode: " + address.geocode + "\n"
  );
}
mmmap.getAddressObjectFromLatLon(13.76887, 100.49342, "th", "address", "generateAddresToText(address)")

 

  1. MM Map API allows get address text from latitude, longitude by using this method
mmmap.getAddressFullTextFromLatLon(latitude, longitude, language, variable_name, callback_fn); 
  • latitude
  • longitude
  • language: Locale code
    • en - get address info in English
    • th - get address info in Thai
  • variable_name: Name of variable that store the results (required)
  • callback_fn: Callback function (string format) when the results are returned (required)

Return: Address (text)

 

Examples:

mmmap.getAddressFullTextFromLatLon(13.76887, 100.49342, "th", "address", "alert(address)");

 

See: http://mapdemo.longdo.com/demo/index-reversegeocode-from-latlon.php

 

RESTful API

Not just javascript, you can also get address results via RESTful API. Here's a simple example for get address from latitude, longitude:

http://search.longdo.com/addr/iden.php?lat=13.73726&lon=100.51274&lang=th&var=address&callback=doProcess(address);&key=xxxxx
  • lat: latitude
  • lon: longitude
  • lang: Locale code
    • en - get address info in English
    • th - get address info in Thai
  • var: Name of variable that store the results (required)
  • callback: Callback function (string format) when the results are returned (required)
  • key: MMMap API key (replace xxxxxx with the registered key)

Return JSON Object:

address = {
	"soi":"ซอยปทุมคงคา",   // Lane name
   	"road":"ถนนเยาวราช",   // Road name
  	"district":"แขวงสัมพันธวงศ์",   // Subdistrict name
	"amphoe":"เขตสัมพันธวงศ์",   // District name
	"province":"กรุงเทพมหานคร",   // Province name
   	"postcode":"10100",   // Post Code
	"geocode":"101302"   // Geocode
 }; 
doProcess(address);

 

Get POI Nearby Location

RESTful API

Not just javascript, you can also get pois results via RESTful API. Here's a simple example for get pois nearby location from latitude, longitude:

http://search.longdo.com/addr/poi2.php?lat=13.76823&lon=100.51023&lang=en&span=0.0003&var=pois&callback=doProcess(pois);&key=xxxxx
  • lat: latitude
  • lon: longitude
  • lang: Locale code
    • en - get info in English
    • th - get info in Thai
  • span: distance (unit: degree)
  • var: Name of variable that store the results (required)
  • callback: Callback function (string format) when the results are returned (required)
  • key: MMMap API key (replace xxxxxx with the registered key)
  • tag: POI's tag. (Optional)
  • bookmark: Index of the first of search results. (default: 0)

Return JSON Object:

pois =  [  
     { "name":"Parusakawan Palace",
        "latitude":"13.768041992219","longitude":"100.510696678114",
        "description":"Sri Ayudhaya Rd., Dusit, Dusit, Bangkok, 10300",
        "status":"A",
        "tel":"",
        "icon":"travel.png",
        "icon_url":"http://mmmap15.longdo.com/mmmap/images/icons/travel.png",
        "showlevel":"15",
        "url":"",
        "ooi_id":"A00146862"
     },  
     ...
     ...
];
doProcess(pois);

/*
  name - location's name
  latitude, longitude - location's position
  description - location's description
  status - location's status (Approved / New)
  tel - location's telephone number
  icon, icon_url - icon image
  showlevel - start zoom level
  url - location's web site
  ooi_id - OOI ID
*/

 

Etc.

Layer

MM Map API allows displaying of map layers together with the base one. In layers, image tiles will be retrieved from image servers using the protocol specified in the configuration. Currently two protocols are supported: the WMS (Web Map Service) and the LONGDO own map image server protocol.

The usage of the Layer API can be illustrated in the example JavaScript code below:

var srtmhillshade = {
    "layertype" : "WMS",
        // can be "WMS" or "LONGDO"
    "name" : "topp:srtm_56_09 - Untiled",
    "url" : "http://geoserver.longdo.com/geoserver/wms",
    "layers" : "SRTM-hillshade",
    "extra" : "&FORMAT=image%2Fpng&TILED=true&TILESORIGIN=95%2C15&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap
        &EXCEPTIONS=application%2Fvnd.ogc.se_inimage',
        // WMS URL except SRS, LAYER, WIDTH, HEIGHT, and BBBOX
    "nocache" : 0, // set to 1 to send the "&nocache=1" parameter to map server for some custom purposes
    "addrand" : 0, // set to 1 to cause additional text "&rnd=<random number>" to be added to make the URL unique and avoid browser cache
    zIndex: 2
    // stack order of this layer
};
mmmap.addLayer(srtmhillshade);

Add this layer into display

mmmap.hideLayer(srtmhillshade);

Hide the layer

mmmap.showLayer(srtmhillshade);

Show the layer (after hiding)

mmmap.deletLayer(srtmhillshade);

Delete the layer

More information please view the example at http://mapdemo.longdo.com/index-layers.php

km/degree

mmmap.getKmPerLat();

Get kilometers per 1 latitude degree

mmmap.getKmPerLong(lat);

Get kilometers per 1 longitude degree at the given latitude

Appropriate Zoom

var appropriate_zoom = mmmap.findAppropriateZoom(points);

Return appropriate zoom level that is less than the current zoom and the position is also still current -- Fits all the points stored in the points array of [long, lat]

 

mmmap.autoMoveAndSetAppropriateZoom(points);

// this function doesn't return value

Move the map to center on all points and set zoom to appropriate zoom level -- Fits all the points stored in the points array of [long, lat]

 

And if all the points stored in array of [lat, long], you can use mmmap.swapLatLonPointsInArray(points_array_of_lat_long) function for swap your points to array of [long, lat]

Examples:

var lat_long_points = [ [13, 100], [13.5, 100.5] ];
var long_lat_points = mmmap.swapLatLonPointsInArray(lat_long_points); // points = [ [100, 13], [100.5, 13.5] ];

var appropriate_zoom = mmmap.findAppropriateZoom(long_lat_points);
mmmap.setZoom(appropriate_zoom);

// or

mmmap.autoMoveAndSetAppropriateZoom(long_lat_points);

 

See example at

- http://mapdemo.longdo.com/demo/index-appropriatezoom.php

- http://mapdemo.longdo.com/demo/index-drawing-appropriatezoom.php

user-defined getPOIs Function

mmmap.setMyGetPOIsFunction(callback);

Overide default POIs function with user-defined function. Parameters of callback are imgid, objidx and resolution. imgid together with resolution can convert to latitude and longitude

See example at http://mapdemo.longdo.com/demo/custom-getpois.php