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

@coex/geosearch

v1.1.1

Published

Nodejs library for finding places using Mapy.cz Suggest API

Downloads

151

Readme

npm version

GeoSearch

Simple JavaScript library to find places all around the world

✓ TypeScript / JavaScript

✓ ESM

✓ CommonJS

✓ Node.js

Datasource: Mapy.cz Suggest API

Demo

https://stackblitz.com/edit/geosearch

Install

npm install @coex/geosearch
# yarn add @coex/geosearch

Usage

City, town, village

Let's find all Springfields in the World

import { GeoSearch } from '@coex/geosearch';

const geoSearch = new GeoSearch();

geoSearch
  .suggest('Springfield', {
    scope: 'muni', // Only cities, villages, (municipalities)
  })
  .then((places) => {
    // ... do something cool
    console.log('Results', places);
  })
  .catch((e) => {
    // Catch Error
    console.error('Error', e);
  });

Places start with

Let's find cities or villages start with Ber in Germany

import { GeoSearch } from '@coex/geosearch';

const geoSearch = new GeoSearch();

geoSearch
  .suggest('Ber', {
    scope: 'muni', // Only cities, villages, (municipalities)
    country: 'de', // Only from Germany
  })
  .then((places) => {
    // ... do something cool
    console.log('Results', places);
  })
  .catch((e) => {
    // Catch Error
    console.error('Error', e);
  });

Public transport

Let's find position of public transport station in the Czech Republic

import { GeoSearch } from '@coex/geosearch';

const geoSearch = new GeoSearch();

geoSearch
  .suggest('kokořín', {
    scope: 'pubt', // Only public transport related places
    country: 'cz', // Only from the Czech Republic
  })
  .then((places) => {
    // ... do something cool
    console.log('Results', places);
  })
  .catch((e) => {
    // Catch Error
    console.error('Error', e);
  });

More!

Let's try to find rivers, lakes, mountains, streets, national parks, areas, tourist attractions, ..., everything what awesome Mapy.cz Suggest API can do.

Results (example)

[
  {
    category: 'municipality_cz',
    highlight: [],
    sentence: '',
    userData: {
      bbox: [Array],
      country: 'Česko',
      district: 'Hlavní město Praha',
      elasticWeight: 0,
      evidenceNumber: '',
      hasAddress: true,
      highlight: [Array],
      highlightSecond: [Array],
      houseNumber: '',
      iconType: 'geo',
      id: 3468,
      img: '',
      importance: 0.763394835100681,
      latitude: 50.0835493857,
      longitude: 14.4341412988,
      mmid: '',
      mmsource: '',
      mmtype: '',
      muniId: '3468',
      municipality: 'Praha',
      nuts: 'CZ0100',
      poiType: '',
      poiTypeId: 0,
      popularity: 1,
      premiseIds: [],
      quarter: '',
      region: 'Hlavní město Praha',
      source: 'muni',
      street: '',
      streetNumber: '',
      suggestFirstRow: 'Praha',
      suggestSecondRow: 'okres Hlavní město Praha, kraj Hlavní město Praha, Česko',
      suggestThirdRow: 'Hlavní město',
      ward: '',
      wikiId: 'Q1085',
      zipCode: '',
    },
  },
];

⚙️ Options

| Option | Type | Default | Description | | ----------- | ---------------------------------------------------------------------------- | ------- | ----------------------------------------------------------------------------------------------- | | scope | 'muni' | 'area' | 'pubt' | 'street' | null | Preferred category of results | | bounds | { sw: LatLng, ne: LatLng} | null | Preffered country boundaries | | country | 'cz' | 'sk' | 'us' | 'de' | 'gb' | 'jp' | null | Preferred country. Same as bounds but with some presets. Feel free to add more via pull request | | lang | 'en' | 'cs' | 'de' | 'pl' | 'sk' | 'ru' | 'es' | 'fr' | cs | Preferred language | | debug | boolean | false | Print additional information to console |

🤝 Development

Developing and debugging library

yarn start

Run demo locally

You can find and modify it in demo/index.ts file

yarn demo

Run tests

yarn test

📝 License

Data source

Awesome Mapy.cz Suggest API from Seznam.cz

Please read this license before use.

This library

Code of this library is licensed under the MIT license.


© 2022 COex