greenstand / treetracker-web-map-core Goto Github PK
View Code? Open in Web Editor NEWThe basic and core module of Greenstand web map application.
License: GNU Affero General Public License v3.0
The basic and core module of Greenstand web map application.
License: GNU Affero General Public License v3.0
When the mouse moves on to the point and clicks it, the highlight and selected effect have some tiny difference from the original icon.
Some hints:
So we can generate new version when we merge PR.
Refer to: https://github.com/Greenstand/treetracker-web-map-core/blob/main/.github/workflows/main.yml
Some hints:
This is pretty easy, please code the code change in the PR to this repo, this embarrassing situation is just because that the web client is still using the Map.js in its repo rather than invoke the core
Greenstand/treetracker-web-map-client#221
Some hints:
The new suite of icons looks like this:
The goal of this issue:
core
provide a setting for this, like: icon_style: 'orange|green|greenB'
the default is the icons now on http://map.treetracker.org (the orange one)Some hints:
Install Jest
for test tool, and set the Jest appropriately, and pass all those tests (under src
folder)
And add simple guide into readme
explaining how to use these commands.
Some hints:
When the first request is made to tileServerUrl: https://{s}.treetracker.org/tiles/
, the map shows correct icons with no problems. Now if a second request is made to a new tileServerUrl tileServerUrl: https://{s}.treetracker.org/tiles/new/
within 50-60 seconds of the first request, the map will still show the old icons. If zoomed in, the map may display the correct new icons (but not always)...
If a new request is made after 1min, the map shows correct icons with no problems
When we open the map for a single planter or org, we need to calculate the initial bounds/map view for the first jump, the previous algorithm is fetching the cluster from API and calculate the view at client side, now we are trying to use a new API to do it: prerequisite: Greenstand/treetracker-query-api#79
So with this API, we simply request the bounds by filter, then manipulate the leaflet to jump to the bounds.
Some hints:
We have designed a new suite of icons, need to be integrated into the map core.
We need:
Some hints:
Do not publish the npm lib on every merge, just do it manually, so we can choose which version to publish.
Some hints:
Some hints:
This issue is about removing unnecessary knowledge from Map.js, to make it more reusable. Please check the Map.js and remove unnecessary relying on in this class, as far as I know, now Map.js know the window, and window.location object, to update the URL, we need to remove it and open a new event or parameter to leave this work to an outsider caller.
Some hints:
When open and zoom in to the map area, nothing is showing, have to zoom out to show tree data.
https://www.treetown.finorx.com/map/?all
Some hints:
We impletement the event system by simply call onXXX function parten, in this PR #20 #21 we try to use events
lib to provide a solid and battle checked approach to implement event system, please migrate all other onXXX event to use
These listner is like onError, onLoad...
Some hints:
Make the core is able to show a geojson source.
The API should be map.addGeoJson(urlToGeoJson | GeoJson)
so some else.
The goal is to pass in a geojson
Possible workflow:
const map = new Map(...);
const geoJsonObject = map.addGeoJson(url);
// jump the the map bounds to fit the geoJson area.
geoJsonObject.focus();
Some hints:
https://www.figma.com/file/XdYFdjlsHvxehlrkPVYq0l/Greenstand-Webmap?node-id=6133%3A21315
https://www.figma.com/file/XdYFdjlsHvxehlrkPVYq0l/Greenstand-Webmap?node-id=6131%3A20768
Some hints:
Even the map seems to have been loaded:
https://dadior.s3.ap-northeast-1.amazonaws.com/Screen%20Recording%202021-12-15%20at%203.07.53%20PM.mp4
Some hints:
When clicking the tree marker/icon, should show a highlighted/selected marker/icon on the tree position.
master
in treetracker-web-map-client for details.Some hints:
Currently, the way to release a new version is:
npm run pre-publish
to build the bundle with webpack.It's inconvenient and easy to make mistakes (forgot to run the command), so we need to pack the code automatically every time we release a version.
Some hints:
With: auto-sematic-release and Github Action, and husky, we should be able to release the map core to npm automatically, after tagging a new version of the core.
Some hints:
Now in the github action, the main.yaml
(please run it with branch main
) will make a release and create correct tag in the repo, but the problem is that the package.json
's version can not be updated automatically.
treetracker-web-map-core/package.json
Lines 1 to 6 in ab4d306
So the version tag doesn't match the npm package.json version.
Some hints:
Some hints:
Some hints:
treetracker-web-map-core/src/Map.js
Lines 365 to 366 in 1fbaa63
So for clients which are going to use the web map core, they can set up the spin behaviors via:
new Map({
disableSpinIcon: boolean,
slowThreshold: [ms],
showLoadingThreshold: [ms],
})
Some hints:
This repository might be the best case for semantic version support. Now there would be 3 places using this core as underlying lib: wallet-web, web-map-client master
branch, and web-map-site
branch.
So they need a precise version to install the core lib, to avoid chaos.
This issue might be related to #2
Some hints:
Just like what we do on https://map.treetracker.org
Some hints:
So we can check the commit message following the rule like: feat: some feature
Some hints:
Now we defined a new spec for the icon URL/route rule:
Use icon=o' query pamaeter rather than the path
/new/` to choose the icon suite.
The spec details is here: https://greenstand.gitbook.io/wallet-web-app/tile-server-specification
So we need to modify the core to follow the new rule.
Here are some links for the design elements:
https://www.figma.com/file/XdYFdjlsHvxehlrkPVYq0l/Greenstand-Webmap?node-id=5336%3A19844
Tree icon:
https://www.figma.com/file/XdYFdjlsHvxehlrkPVYq0l/Greenstand-Webmap?node-id=6131%3A21214
Highlighted tree:
https://www.figma.com/file/XdYFdjlsHvxehlrkPVYq0l/Greenstand-Webmap?node-id=6133%3A21308
Selected tree:
https://www.figma.com/file/XdYFdjlsHvxehlrkPVYq0l/Greenstand-Webmap?node-id=6133%3A26944
Small size:
https://www.figma.com/file/XdYFdjlsHvxehlrkPVYq0l/Greenstand-Webmap?node-id=5336%3A19844
Basically, the big and small icons are just different in size, the shape is the same. The way I'm doing in tile server is: export the element from Figma, choose 3x size png, so the icon would be clear when I display it. I just need to shrink the image to get the correct icon:
for desktop:
transform: scale(0.33);
for mobile:
transform: scale(0.27);
Some hints:
Currently, we init the Map object by bounds or filters, like: userid=1
Now we should be able to make the Map object being able to switch between these states, like change from userid=1
to treeid=xxx
, vice verse
Some hints:
Some hints:
The map object will automatically update the URL with the changing bounds of the map.
This feature works for the previous/old version of the map because we don't have a further path for the map, but now we have multiple levels of route/path, so this behavior is inappropriate:
Some hints:
Map({
enableControlPanel: true,
})
So we got the zoom in/out button on the bottom right corner.
leaflet already has this feature, so we just need to expose it.
Some hints:
So we can install this repo by npm install @greenstand/treetracker-web-map-core
Please ask me for the greenstand official npm account.
Some hints:
Please add a setting to control the animation showing up when loading the map.
It could be: duration=1000 so if we set duration=0, the map will show up without any animation, and there should be a default duration, simply set this value to the default value if the user didn't set it explicitly, (it's good to set current value in the code as the default value)
Some hints:
So when can install it by npm install @greenstand/treetracker-web-map-core
Some hints:
Our test looks like this picture below, we need to find a good way to verify the map result, like, the data on the map was loaded correctly, say, there are several cluster icons on the map, it's not a normal/traditional case for testing, also, those cluster on the map isn't css+html, they are pictures.
Some hints:
Prerequisite: Greenstand/treetracker-query-api#78
Currently the nearest tree
feature (the arrow icon indicating the nearest tree on the map when people get lost on the map) is using the old API, now we need to switch to the new API.
Some hints:
We need to use an option to set the icon style (switch between icons suits), it could be like:
new Map({
iconSuite: 'old' | 'green',
}
In the near future, we at least have three suites of icon:
In the future, it's possible we are going to design a new icon for our VIP partner.
Some hints:
By executing github action.
Some hints:
We can not use/import the leaflet css when we installing the core to other project, like the treetracker-web-map-client next.js will throw error:
the reason:
https://nextjs.org/docs/messages/css-npm
Seems because we didn't import the bin/dist of the bundle, we directly import the src
file in client, please figure out the correct way to install this package/lib to other clients.
Some hints:
Upon zooming in (fast) or clicking on regions, the previous big circles with number of trees in regions are disappearing very slowly most of the time. The big circle is zoomed in and is covering big part of the screen and at the same time we are already loading another/detailed regions with tree numbers. This doesn't look nice for a user. We should dispose/dismiss the previous circle more effectively.
Details:
Mobile and Desktop devices
Now, every time we want to release/publish new version, we need to pack the file to bundle js, by executing: npm run pre-publish
we need to find a convenient way to do it automatically, which means, every time we do the publish to npm action, we can get the pack job done automatically.
Some hints:
we need to migrate the code below to the core:
https://github.com/Greenstand/treetracker-web-map-client/blob/9257c09f6d56d8a041b28e26f7eb52dbde7f33bf/src/components/App.js#L321-L340
because it is more about a pure map operation.
Some hints:
The case is when the tile-server getting slow or even crashed, then on the map, the user can not tell what happened, just a map with satellite background and without any tree data.
So we need to find a good way to inform the user something went wrong.
Some hints:
Ran into problem when client trying to integrate the core (a react project):
82 File was processed with these loaders:
83 * ./node_modules/[email protected]@babel-loader/lib/index.js
84 You may need an additional loader to handle the result of these loaders.
85 | }
86 |
87 > _handleLoading = t => {
88 | i.warn("start loading tile..."), i.warn("wait for show loading for %d sed"
89 , this.options.showLoadingThreshold), this.showLoadingTimer = setTimeout(() => {
90 | i.warn("show loading..."), this.options.onShowLoading();
Some hints:
Otherwise move the mouse over the icon, the highlighted icon has some difference with the original icon
https://dadior.s3.ap-northeast-1.amazonaws.com/Screen%20Recording%202022-02-10%20at%202.51.33%20PM.mp4
Some hints:
This feature is for navigating between tree point on the map, refer to this link: https://map.treetracker.org/?&bounds=-13.218893967568878,8.427470595924952,-13.187994919717314,8.444408553605653 the load is slow, be patient. ( when you click the tree icon, a panel will show up, on the panel, there is the next/prev button)
Basically, we need to be able to know from the map core: if there are multiple tree points showing up on the map, then, tell the map core to jump to (select) the next tree point.
So the API of this feature would be like:
function treeCountOnTheMap() : number // return the number of tree on the map
function goNextTree() : void // indicate core to jump to the next tree.
function getPreviousTree() : void // jump to previous tree
Actually, we almost implemented this feature in the master branch of web map client https://github.com/Greenstand/treetracker-web-map-client so please refer to code there.
Some hints:
Need to:
readme
explaining how to use these commands.This project should be the same as this repo: https://github.com/Greenstand/treetracker-web-map-client
So please refer to it.
Some hints:
Should be able to:
Some hints:
Actually, the function of this feature has been finished in the https://github.com/Greenstand/treetracker-web-map-client/tree/master also you can find it in the website online : map.treetracker.org
The goal of this issue is to:
core
Some hints:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.