Creating a Simple Map

The MapLarge Javascript API is a client side library used to create maps and layers. It interacts with the MapLarge web services that are drop in compatible with Google Maps, Leaflet, ESRI and other mapping API's.  
To use the MapLarge Javascript API, add the following script tag at the top of your HTML page in the header section:

<script type="text/javascript" src="//"></script>
Note: If directed to a specific MapLarge server, specify it in the URL.

There are three main steps for displaying a map on a web page:

1. Create a map container and attach it to the page DOM 
2. Create a map instance within the div
3. Create and display map layers.

Example with Editable Source Code

  1. <head>
  2. <script type="text/javascript" src="/JS"></script>
  3. <script type="text/javascript">
  4. ml.onload(function() {
  6. //create a map zoomed in on Atlanta, GA (34,-84)
  7. //the second parameter is a Object literal
  8. var map = new'mapDiv', { lat: 33.709, lng: -84.404, z: 9 });
  10. //add a layer with no style: default is "red dots"
  11. var layer = new ml.layer(map,
  12. {
  13. query: {
  14. table: 'hms/hotels', //table name = hotels
  15. select: '' //geography = dots
  16. },
  18. });
  20. //show the layer
  23. });
  24. </script>
  25. </head>
  26. <body>
  27. <div id="mapDiv" style="width:100%;height:100%;"></div>
  28. </body>

MapEditor JSON View

Almost all MapLarge API calls can also be configured without coding by using the advanced MapEditor.  

Open MapEditor by adding ?showeditor=true to the map URL.

Note: Replace with your server if hosted in another location.

MapEditor can be opened on any Example or embedded site by holding down CRTL and pressing M.

Use MapEditor to create or edit maps and layers.  MapEditor can also be used to capture code snippets for use in custom JavaScript. Access the JSON by pressing the View/Edit JSON button on a Map or Layer in MapEditor.  

JSON object shown in the Map or Layer JSON editor is simply a valid options object that may be passed into the constructor for a map or layer.  

The image below shows how to open the 
JSON view in the advanced Map Editor.  

Advanced Map Editor JSON View