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

@simon_brooke/geocsv

v1.0.0

Published

An ultra-lightweight tool to show comma-separated value data on a map.

Downloads

5

Readme

geocsv-js

An even more ultra-lightweight tool to show comma-separated value data on a map.

Demo

There's a working demo site, from which you can crib how to integrate this into your own website.

Other variants

This is a little project I've played about with, and there are now three variants:

  1. geocsv is a fairly heavyweight web-app with both client-side and serverside components. It was the first version, and is the only version which meets the original requirement of being able to present data from Google Sheets, but it's a remarkably heavyweight solution to what should be a simple problem.
  2. geocsv-lite is a much lighter, client-side only reworking of the problem, in ClojureScript. I still wasn't satisfied that this was light enough.
  3. geocsv-js is a reworking in native JavaScript without any frameworks or heave libraries, except Leaflet. It is vastly lighter, and probably the one to use in most applications.

Overview

This is a third iteration of GeoCSV. The original was written quickly in Clojure and ClojureScript, with CSV parsing done server side and React (via re-frame) driving the client side. That's my comfort zone; but it had the benefit that my customer wanted to pull data from Google Sheets, which you can't do from client side (or at least I don't know how to) because of cross-site scripting protections.

But it's also ludicroously heavyweight for what seemed such a simple requirement. The second iteration, geocsv-lite, was written in ClojureScript without heavyweight libraries, and is client-side only. It works, as you can see; but it still results in a much heavier page than I think is justified.

So this project is well out of my comfort zone: it's an attempt to build as lightweight as possible in raw JavaScript, without frameworks or big libraries. Of course, this version also cannot pull data from remote sites because of cross-site scripting rules, and I haven't found a workaround for that.

However, if all you want to do is pull data from the same server you're serving the page from, this will work for you.

The CSV file must have

  • column names in the first row;
  • data in all other rows;
  • a column whose name is name, which always contains data;
  • a column whose name is latitude, whose value is always a number between -90.0 and 90.0;
  • a column whose name is longitude, whose value is always a number between -180.0 and 180.90

Additionally, the value of the column category, if present, will be used to select map pins from the map pins folder, if a suitable pin is present. Thus is the value of category is foo, a map pin image with the name Foo-pin.png will be selected.

Note that, unlike in geocsv, THERE IS NO DEFAULT PIN, as there is no server side intelligence so we cannot query the server for pin names. So a default pin will be shown only if either

  1. There is no category column, or
  2. If the category column is empty

License

Copyright © 2020 Simon Brooke

Licensed under the GNU General Public License, version 2.0 or (at your option) any later version.