npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

esri-leaflet-related

v3.0.0

Published

A Leaflet plugin that allows users to query related tables.

Downloads

63

Readme

Esri Leaflet Related Records

Esri Leaflet Related Records is a small API helper to assist querying related tables published in ArcGIS Server or ArcGIS Online. It relies on the minimal Esri Leaflet Core which handles abstraction for requests and authentication when necessary. You can find out more about the Esri Leaflet Core here.

Example

Note that the latest version of this plugin requires changes introduced in esri-leaflet 2.0.0-beta.6.

Take a look at this sample to see it in action.

<!DOCTYPE html>
<html>
<head>
  <meta charset=utf-8 />
  <title>related table</title>
  <meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />

  <!-- Load Leaflet from CDN-->
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/leaflet.css" />
  <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/leaflet.js"></script>

  <!-- Load Esri Leaflet from CDN -->
  <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/esri-leaflet.js"></script>

  <!-- Esri Leaflet Related -->
  <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/esri-leaflet-related.js"></script>

  <style>
    body {margin:0;padding:0;}
    #map {
      position: absolute;
      top: 0;
      bottom: 0;
      right: 0;
      left: 0;
    }
  </style>
</head>
<body>
<div id="map"></div>

<script>
  var map = L.map('map').setView([34.059, -117.203], 14);
  L.esri.basemapLayer('Topographic').addTo(map);

  var fl = L.esri.featureLayer({
    url: '//services.arcgis.com/uCXeTVveQzP4IIcx/ArcGIS/rest/services/stationActivity/FeatureServer/0'
  }).addTo(map);

  var query = L.esri.Related.query(fl);

  //wire up event listener to fire query when users click on a feature
  fl.on("click", queryRelated);

  function queryRelated (evt) {
    query.objectIds([evt.layer.feature.id]).relationshipId("0").run(function(error, response, raw) {
        var currentFeature = fl.getFeature(evt.layer.feature.id);
        currentFeature.bindPopup('matching rows: ' + response.features.length);
        currentFeature.openPopup();
    })
  }

</script>

</body>
</html>

API Reference

L.esri.Related.Query

Development Instructions

  1. Fork and clone Esri Leaflet Related
  2. cd into the esri-leaflet-related folder and install the dependencies with npm install
  3. Run npm start from the command line. This will compile minified source in a brand new dist directory, launch a tiny webserver and begin watching the raw source for changes.
  4. The example at debug/sample.html should 'just work'
  5. Make your changes and create a pull request

Dependencies

Esri Leaflet Related Records relies on the minimal Esri Leaflet Core which handles abstraction for requests and authentication when neccessary. You can fine out more about teh Esri Leaflet Core on the Esri Leaflet downloads page.

Resources

Issues

Find a bug or want to request a new feature? Please let us know by submitting an issue.

Contributing

Esri welcomes contributions from anyone and everyone. Please see our guidelines for contributing.

Terms and Conditions

Signup for an ArcGIS for Developers account or purchase an ArcGIS Online Organizational Subscription.

  1. Once you have an account you are good to go. Thats it!
  2. If you use this library in a revenue generating application or for government use you must upgrade to a paid account. You are not allowed to generate revenue while on a free plan.

This information is from the ArcGIS for Developers Terms of Use FAQ

Licensing

Copyright 2017 Esri

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

A copy of the license is available in the repository's LICENSE file.