Giter Site home page Giter Site logo

mmayeda / treetracker-web-map-core Goto Github PK

View Code? Open in Web Editor NEW

This project forked from greenstand/treetracker-web-map-core

0.0 0.0 0.0 965 KB

The basic and core module of Greenstand web map application.

License: GNU Affero General Public License v3.0

Shell 0.14% JavaScript 91.00% CSS 8.86%

treetracker-web-map-core's Introduction

treetracker-web-map-core

This is the core module for Greenstand web map application.

NPM Version

Dev Server

npm run dev

Testing

Integration Tests With Cypress

npm run cy

Debuging

To open detailed log (default is WARN), set the loglevel as below:

image

Linting and Formatting

Note: All of these actions will be automatically run when appropriate with lint-staged during the git pre-commit stage.

check for lint errors

npm run lint

check for lint errors with auto fix

npm run lint:fix

format with prettier

npm run format

sort package.json

npx sort-package-json

Publishing

build project as production module

npm run pre-publish

execute the github action to release the tag.

check issue 41 here

Usage

import module in different app

import { Map } from 'treetracker-web-map-core'

API

  • construction:
map = new Map({
    onLoad: () => console.log("onload"),
    onClickTree: () => console.log("onClickTree"),
    onFindNearestAt: () => console.log("onFindNearstAt"),
    onError: () => console.log("onError"),
});
  • listen to map events:
  map.on("moveEnd", handleMoveEnd);
  • set the filter for the map:
map.setFilters({
  userid: 940,
})

this function will trigger rerendering of the map.

  • manipulate the map:

    • gotoView(lat, lon, zoomLevel)
    • gotoBounds(bounds)
    • getInitialViewer() // get an appropriate view for the current map with filters
    • selectTree(treeObject)

check dist/index.html for a demo

how to debug the core on the client side

The senerio: sometime we need to find a easy way to debug the core in the client side, for example, the web map client repo, it's installing the core by npm, so it's hard to change code in core on the client side, we can install the core by folder locally, and get the change on the client side immediately, to do so:

  1. Download the web map core repository, git clonet [path to repo]
  2. Change to code you want in core
  3. Change the version number in package.json (this is neccessary, if don't do it, it's posssible the client will ignore/skip the installment)
  4. Generate the bundle: npm run pre-publish (this is nessessary, the npm will fetch the bundle file rather than the src files)
  5. Install the core in web map client: npm install --save [relative path to the core folder]
  6. Restart the web map client

treetracker-web-map-core's People

Contributors

dadiorchen avatar semantic-release-bot avatar quaidbartolomei avatar pratikmdhr avatar keyy123 avatar siddhant-k-code avatar suokn avatar jamwalab avatar rubensmn avatar yi-xuan-97 avatar quorth0n avatar kparikh9 avatar mohmn avatar muhon9 avatar vwroli avatar zavenarra 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.