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="//e.maplarge.com/JS"></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() {
  5.  
  6. //create a map zoomed in on Atlanta, GA (34,-84)
  7. //the second parameter is a Object literal
  8. var map = new ml.map('mapDiv', { lat: 33.709, lng: -84.404, z: 9 });
  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: 'geo.dot' //geography = dots
  16. },
  17.  
  18. });
  19.  
  20. //show the layer
  21. layer.show();
  22.  
  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 e.maplarge.com 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.  

The 
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