# react-map-location

> provide simple location based features

Latest version **1.0.3** (published 2021-05-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-map-location
pnpm add react-map-location
yarn add react-map-location
bun add react-map-location
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2021-05-11 |
| First published | 2021-05-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 8.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | keyur kakadiya |
| Maintainers | keyurkakadiya53 |
| Keywords | react-map, react-location, react-route, react-current-location, react-weather, weather, cityinfo, react-latlong, location, map, js, city-temp, current-location, here-map, location-search, searching |

## Links

- npm: https://www.npmjs.com/package/react-map-location
- Repository: https://github.com/kakadiyakeyur53/react-map-location
- Homepage: https://github.com/kakadiyakeyur53/react-map-location#readme
- Issues: https://github.com/kakadiyakeyur53/react-map-location/issues
- npm.io page: https://npm.io/package/react-map-location

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.3 (latest) — 2021-05-11
- 1.0.2 — 2021-05-11
- 1.0.1 — 2021-05-11
- 1.0.0 — 2021-05-11

## 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.

```javascript
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.

```javascript
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.

```javascript
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.

```javascript
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.

```javascript
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](https://developer.here.com/)


## Example of usage :

Here replace {CITY_NAME},{LATITUDE},{LONGITUDE} AND {YOUR_API_KEY} with your own data.

```javascript
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')
);
```

---
_Source: https://npm.io/package/react-map-location · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
