GithubHelp home page GithubHelp logo

classicvalues / geofire-js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from firebase/geofire-js

1.0 0.0 0.0 5.22 MB

GeoFire for JavaScript - Realtime location queries with Firebase

JavaScript 1.25% TypeScript 96.72% Shell 2.03%

geofire-js's Introduction

GeoFire for JavaScript Actions Status Coverage Status Version

GeoFire is an open-source library that allows you to store and query a set of keys based on their geographic location. At its heart, GeoFire simply stores locations with string keys. Its main benefit, however, is the possibility of retrieving only those keys within a given geographic area - all in realtime.

GeoFire uses the Firebase Realtime Database for data storage, allowing query results to be updated in realtime as they change. GeoFire selectively loads only the data near certain locations, keeping your applications light and responsive, even with extremely large datasets.

GeoFire is designed as a lightweight add-on to Firebase. To keep things simple, GeoFire stores data in its own format and its own location within your Firebase Realtime Database. This allows your existing data format and Security Rules to remain unchanged while still providing you with an easy solution for geo queries.

If you're looking to use this library with Cloud Firestore, see the documentation on implementing geoqueries on Firestore.

GeoFire is designed as a lightweight add-on to Firebase. To keep things simple, GeoFire stores data

A compatible GeoFire client is also available for Objective-C and Java.

Table of Contents

Add GeoFire to your project

The Firebase JS SDK is a peer dependency of GeoFire. Run the following command to install both libraries:

$ npm install geofire firebase --save

HTML

Alternatively, you can include GeoFire in your HTML. To do so download a minified or non-minified version of GeoFire from the releases page of this GitHub repository. Then, deploy it to Hosting in your Firebase project.

<!-- Firebase -->
<script src="https://www.gstatic.com/firebasejs/8.0.1/firebase-app.js"></script>
    <script src="https://www.gstatic.com/firebasejs/8.0.1/firebase-database.js"></script>

<!-- GeoFire (TODO: substitute in your own project id)-->
<script src="https://my-firebase-project.web.app/geofire-5.0.1.min.js"></script>

Bower

If you use Bower, the Firebase dependency will be downloaded automatically:

$ bower install geofire --save

Documentation

Examples

You can find a full list of our demos and view the code for each of them in the examples directory of this repository. The examples cover some of the common use cases for GeoFire and explain how to protect your data using the Firebase Database Security Rules.

Example Usage

Assume you are building an app to rate bars and you store all information for a bar, e.g. name, business hours and price range, at /bars/<bar-id>. Later, you want to add the possibility for users to search for bars in their vicinity. This is where GeoFire comes in. You can store the location for each bar using GeoFire, using the bar IDs as GeoFire keys. GeoFire then allows you to easily query which bar IDs (the keys) are nearby. To display any additional information about the bars, you can load the information for each bar returned by the query at /bars/<bar-id>.

Migration Guides

Using an older version of GeoFire and want to upgrade to the latest version? Check out our migration guides to find out how!

Contributing

If you'd like to contribute to GeoFire, please first read through our contribution guidelines. Local setup instructions are available here.

geofire-js's People

Contributors

abeisgoat avatar asciimike avatar dependabot[bot] avatar feiyang1 avatar firebase-ops avatar idanb11 avatar jacob-israel-turner avatar jamestamplin avatar jdimond avatar jhuleatt avatar michaelsolati avatar mikepugh avatar mimming avatar morganchen12 avatar npmcdn-to-unpkg-bot avatar puf avatar robertdimarco avatar ronhe avatar samtstern avatar sararob avatar startupandrew avatar stefek99 avatar

Stargazers

 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.