esri-leaflet
Version:
Leaflet plugins for consuming ArcGIS Online and ArcGIS Server services.
171 lines (141 loc) • 9.45 kB
HTML
<!--[if lt IE 7 ]> <html class="ie6"> <![endif]-->
<!--[if IE 7 ]> <html class="ie7"> <![endif]-->
<!--[if IE 8 ]> <html class="ie8"> <![endif]-->
<!--[if IE 9 ]> <html class="ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html class="not-ie"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<title>Utilities | Esri Leaflet</title>
<meta name="description" content="Esri Leaflet">
<meta name="viewport" content="width=device-width">
<!--[if lt IE 9]>
<script src="//cdn.jsdelivr.net/html5shiv/3.7.2/html5shiv-printshiv.js"></script>
<![endif]-->
<!-- google fonts -->
<link href='//fonts.googleapis.com/css?family=Vollkorn:400italic,700italic,400,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="//brick.a.ssl.fastly.net/Source+Code+Pro:300">
<link href='//fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
<!-- stylesheet -->
<link rel="stylesheet" href="../css/style.css">
<!-- leaflet -->
<link rel="stylesheet" href="//cdn.jsdelivr.net/leaflet/0.7.7/leaflet.css" />
<!-- require combined leaflet, esri leaflet and jsdelivr-rum -->
<script src="//cdn.jsdelivr.net/leaflet/0.7.7/leaflet.js"></script>
<!--script src="//cdn.jsdelivr.net/leaflet.esri/1.0.3/esri-leaflet.js"></script-->
<script src="../../js/esri-leaflet-src.js"></script>
<script src="//cdn.jsdelivr.net/jsdelivr-rum/latest/jsdelivr-rum.min.js"></script>
<!-- 'livereload' for development -->
<script src="//localhost:35729/livereload.js"></script>
<!-- Google Analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-44963317-3', 'auto');
ga('send', 'pageview');
</script>
<!-- End Google Analytics -->
</head>
<body>
<div class="page-content ">
<div class="container">
<a class="site-nav" href="../" class="left logo">Esri Leaflet</a>
<nav class="right">
<a class="site-nav" href="../examples/">Examples</a>
<a class="site-nav" href="../api-reference/">API Reference</a>
<a class="site-nav" href="../download/">Download</a>
<a class="site-nav" href="https://github.com/Esri/esri-leaflet">View on GitHub</a>
</nav>
</div>
<div id="background-map" class="background-map"></div>
<div class="container white">
<aside class="sidebar">
<h5>L.esri.Layers</h5>
<nav>
<a href="../api-reference/layers/basemap-layer.html">BasemapLayer</a>
<a href="../api-reference/layers/feature-layer.html">FeatureLayer</a>
<a href="../api-reference/layers/tiled-map-layer.html">TiledMapLayer</a>
<a href="../api-reference/layers/dynamic-map-layer.html">DynamicMapLayer</a>
<a href="../api-reference/layers/image-map-layer.html">ImageMapLayer</a>
<a href="../api-reference/layers/clustered-feature-layer.html">ClusteredFeatureLayer</a>
<a href="../api-reference/layers/heatmap-feature-layer.html">HeatmapFeatureLayer</a>
</nav>
<h5>L.esri.Tasks</h5>
<nav>
<a href="../api-reference/tasks/query.html">Query</a>
<a href="../api-reference/tasks/find.html">Find</a>
<a href="../api-reference/tasks/identify-features.html">Identify Features</a>
<a href="../api-reference/tasks/identify-image.html">Identify Image</a>
<a href="../api-reference/tasks/task.html">Task</a>
</nav>
<h5>Misc.</h5>
<nav>
<a href="../api-reference/request.html">Request</a>
<a href="../api-reference/util.html">Util</a>
<a href="../api-reference/events.html">Events</a>
</nav>
<h5>Base Classes</h5>
<nav>
<a href="../api-reference/services/image-service.html">ImageService</a>
<a href="../api-reference/services/feature-layer.html">FeatureLayerService</a>
<a href="../api-reference/services/map-service.html">MapService</a>
<a href="../api-reference/services/service.html">Service</a>
</nav>
</aside>
<div class="main-content">
<h1 id="l-esri-util">L.esri.Util</h1>
<p>Utility methods used internally by Esri Leaflet. These methods are useful for converting data between ArcGIS and Leaflet formats.</p>
<table>
<thead>
<tr>
<td>Method</td>
<td>Returns</td>
<td>Description</td>
</tr>
</thead>
<tbody>
<tr>
<td><code>extentToBounds(<nobr class="param"><span><<a href="http://resources.arcgis.com/en/help/arcgis-rest-api/#/Geometry_Objects/02r3000000n1000000/">Extent</a>></span> <code>extent</code></nobr>)</code></td>
<td><code><a href="http://leafletjs.com/reference.html#latlngbounds">LatLngBounds</a></code></td>
<td>Converts ArcGIS Extent objects to Leaflet <a href="http://leafletjs.com/reference.html#latlngbounds">LatLngBounds</a> objects.</td>
</tr>
<tr>
<td><code>boundsToExtent(<nobr class="param"><span><<a href="http://leafletjs.com/reference.html#latlngbounds">LatLngBounds</a>></span> <code>bounds</code></nobr>)</code></td>
<td><code><a href="http://resources.arcgis.com/en/help/arcgis-rest-api/#/Geometry_Objects/02r3000000n1000000/">Extent</a></code></td>
<td>Converts Leaflet <a href="http://leafletjs.com/reference.html#latlngbounds">LatLngBounds</a> objects to ArcGIS Extent objects.</td>
</tr>
<tr>
<td><code>arcgisToGeojson(<nobr class="param"><span><<a href="http://resources.arcgis.com/en/help/arcgis-rest-api/#/Geometry_Objects/02r3000000n1000000/">ArcGIS Geometry</a>></span> <code>arcgis</code></nobr>)</code><br><code>arcgisToGeojson(<nobr class="param"><span><<a href="http://resources.arcgis.com/en/help/arcgis-rest-api/#/Feature_object/02r3000000n8000000/">ArcGIS Feature</a>></span> <code>arcgis</code></nobr>)</code></td>
<td><code><a href="http://geojson.org/geojson-spec.html#geojson-objects">GeoJSON</a></code></td>
<td>Converts <a href="http://resources.arcgis.com/en/help/arcgis-rest-api/#/Geometry_Objects/02r3000000n1000000/">ArcGIS Geometry Objects</a> or <a href="http://resources.arcgis.com/en/help/arcgis-rest-api/#/Feature_object/02r3000000n8000000/">ArcGIS Feature Objects</a> objects to <a href="http://geojson.org/geojson-spec.html#geojson-objects">GeoJSON</a>. If you pass a GeoJSON Feature or FeatureCollection you should also pass <code>idAttribute</code> to assign a property from the feature attributes to the ID of the GeoJSON Feature, <code>'OBJECTID'</code> or <code>'FID'</code> attributes by default.</td>
</tr>
<tr>
<td>geojsonToArcGIS(<nobr class="param"><span><<a href="http://geojson.org/geojson-spec.html#geojson-objects">GeoJSON</a>></span> <code>geojson</code></nobr>, <nobr class="param"><span><String></span> <code>idAttribute</code></nobr>)</td>
<td><code>Object</code></td>
<td>Converts <a href="http://geojson.org/geojson-spec.html#geojson-objects">GeoJSON</a> objects to <a href="http://resources.arcgis.com/en/help/arcgis-rest-api/#/Geometry_Objects/02r3000000n1000000/">ArcGIS Geometry Objects</a> or <a href="http://resources.arcgis.com/en/help/arcgis-rest-api/#/Feature_object/02r3000000n8000000/">ArcGIS Feature Objects</a>. If you pass a GeoJSON Feature or FeatureCollection you should also pass <code>idAttribute</code> to assign a property in the output features to represent the features id, <code>'OBJECTID'</code> by default.</td>
</tr>
<tr>
<td>responseToFeatureCollection(<nobr class="param"><span><Object></span> <code>response</code></nobr>, <nobr class="param"><span><String></span> <code>idAttribute</code></nobr>)</td>
<td><code><a href="http://geojson.org/geojson-spec.html#feature-collection-objects">FeatureCollection</a></code></td>
<td>Converts an API response (returned by identify, query or find API methods) to a <a href="http://geojson.org/geojson-spec.html#feature-collection-objects">GeoJSON FeatureCollection</a>. This is used internally by <code><a href="../api-reference/tasks/query.html">L.esri.Tasks.Query</a></code>, <code><a href="../api-reference/tasks/identify.html">L.esri.Tasks.Identify</a></code> and <code><a href="../api-reference/tasks/find.html">L.esri.Tasks.Find</a></code> to convert responses.</td>
</tr>
<tr>
<td>cleanUrl(<nobr class="param"><span><String></span> <code>url</code></nobr>)</td>
<td><code>String</code></td>
<td>Used internally to ensure that URLs have no leading or trailing whitespace and have a leading slash.</td>
</tr>
</tbody>
</table>
<p><a href="http://github.com/esri/esri-leaflet/edit/master/site/source/pages/api-reference/util.md">Edit this page on GitHub</a></p>
</div>
<div style='clear:both;'></div>
</div>
<div class="container centered-text">
<p class="copyright">Esri Leaflet is a project from the <a href="http://pdx.esri.com">Esri PDX R&D Center</a> and the <a href="https://github.com/Esri/esri-leaflet/graphs/contributors">Esri Community</a></p>
</div>
</div>
<script src="../js/script.js"></script>
</body>
</html>