Code Monkey home page Code Monkey logo

react-leaflet-demo's Introduction

React-Leaflet Demo

The purpose of this project is to show a minimal example, of how-to use Leaflet whithin React.

Leaflet is an open-source JavaScript library for building interactive maps.

This project uses the react-leaflet library, which packages Leaflet into React components.

Please take some time to get familiar with the react-leaflet library, and with Leaflet itself, by reading the documentation.

On the github repository of the project, you will find a folder with examples

To support geocoding, the open cage API client is used. OpenCage is an easy, open, worldwide, affordable API to convert coordinates to and from places. Take some time to read the OpenCage FAQ. In order to use OpenCage, you will need to sign up for an API key.

INSTALL

First sign up to get a free API key from OpenCage. Then create a .env file on the root folder of this project, with the following content:

REACT_APP_OCD_API_KEY=[Your-api-key]

Run this application with yarn:

yarn
yarn start

Then open it on a browser, at:

http://localhost:5000

Deploy

Please ignore this part, if you just want to run the application on local!

This application was deployed at heroku

git push heroku master

You can view the deployed application on:

Use

You can use this application to add points to the map. The application will read any address, city or postcode as a string, and display it as a marker on the map.

To try it out, input any address into the input box. The map bounds will be adjusted to display this point, using a flying animation. You can try it with the coordinates of any other location (in WGS84) in the earth's surface.

You can also use this application to add markers to the map, just by clicking in the map's surface.

react-leaflet-demo's People

Contributors

doublebyte1 avatar leighhalliday avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.