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

react-map-location

v1.0.3

Published

provide simple location based features

Downloads

14

Readme

react-map-location

installation

npm :-

npm install react-map-location

yarn :-

yarn add react-map-location

functionality

  1. To find current position latitude and longitude.

  2. To know information about your city with city name.

  3. To know information of given location using latitude and longitude.

  4. Weather information of your city.

  5. Know weather information base on latitude and longitude.

Functions :

CurrentLocation :

Using this function you find your current position.

This function return object with latitude and longitude attributes.

import { CurrentLocation } from "react-map-location";
const { latitude, longitude } = CurrentLocation();

CityInfo :

This function take two argument which is name of city and your api key.

It returns information of city like lat,long,city,state,country, postal code.

import { CityInfo } from "react-map-location";
const cityInfo = CityInfo({CITY_NAME},{YOUR_API_KEY});

LocationInfo :

This function contain 3 argument 1.latitude, 2.longitude , 3.api key as attribute.

This function returns information about city name, country,state,postal code.

import { LocationInfo } from "react-map-location";
const locationTnfo = LocationInfo({LATITUDE}, {LONGITUDE},{YOUR_API_KEY});

CityWeather :

This function take two argument as attribute 1.city name & 2.api key.

It is return the weather information of city like

temperature : min_temp, max_temp

Wind : direction, speed , description

Sun moon position : sunrise , sunset

Pressure , humidity etc.

import { CityWeather } from "react-map-location";
const cityWeather = CityWeather({CITY_NAME},{YOUR_API_KEY});

LocationWeather :

This function take 1.langitude , 2.latitude & 3.api key as an attributes and return weather information.

import { LocationWeather } from "react-map-location";
const locationWeather = LocationWeather({LATITUDE}, {LONGITUDE},{YOUR_API_KEY});

Prerequisite

You have to your own here API key

generate your own api key by create project on here platform

Example of usage :

Here replace {CITY_NAME},{LATITUDE},{LONGITUDE} AND {YOUR_API_KEY} with your own data.

import React from 'react';
import ReactDOM from 'react-dom';
import { CurrentLocation, CityInfo, LocationInfo, CityWeather, LocationWeather} from "react-map-location";


const = App() => {

  //object destructuring of CurrentLocation functin's return object
  const { latitude, longitude } = CurrentLocation();
  const cityInfo = CityInfo({CITY_NAME},{YOUR_API_KEY});
  const locationTnfo = LocationInfo({LATITUDE}, {LONGITUDE},{YOUR_API_KEY});
  const cityWeather = CityWeather({CITY_NAME},{YOUR_API_KEY});
  const locationWeather = LocationWeather({LATITUDE}, {LONGITUDE},{YOUR_API_KEY});


  console.log(latitude);
  console.log(longitude);
  console.log(cityInfo);
  console.log(locationTnfo);
  console.log(cityWeather);
  console.log(locationWeather);
}


ReactDOM.render(
  <>
    <App />
  </>,
  document.getElementById('root')
);