Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

added new baselayer with various styling #70

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

shivamSspirit
Copy link

add various types of styling layers

@netlify
Copy link

netlify bot commented Oct 28, 2021

👷 Deploy request for raster-playground pending review.
Visit the deploys page to approve it

🔨 Explore the source changes: b958d1a

@shivamSspirit
Copy link
Author

leave feedback so i can improve as soon as possible

@srijitcoder
Copy link
Contributor

srijitcoder commented Nov 23, 2021

  • On the first load this is what it shows (Run the URL without any params just domain)... White map state
    image

@srijitcoder
Copy link
Contributor

  • Make the base layer selector UI something similar to google maps (Not exactly same... Take your UI liberty)
    Something like an image selector
    image

From this
image

@srijitcoder
Copy link
Contributor

  • The text colour should change dynamically change on basis of base map theme (White text on a grey base map is not readable)
    image

Comment on lines +1 to +6
REACT_APP_MAPBOX_STYLE_ACCESS_TOKEN=pk.eyJ1Ijoic2hpdmFtLXNvbmkiLCJhIjoiY2t3OTFhdTFiMDR0OTJucWxhdG13bnk0dSJ9.eV9aMwxPXkIDz9DkUe5HdA
REACT_APP_MAPBOX_LIGHT_STYLE=https://api.mapbox.com/styles/v1/shivam-soni/ckvb1lz88098p16s55aog1tvv/tiles/256/{z}/{x}/{y}
REACT_APP_MAPBOX_DARK_STYLE=https://api.mapbox.com/styles/v1/shivam-soni/ckvb1pult2aon14mt5de2lc79/tiles/256/{z}/{x}/{y}
REACT_APP_MAPBOX_SATELLITE_STYLE=https://api.mapbox.com/styles/v1/shivam-soni/ckvb1rchjc1ut14s7lsi66s3g/tiles/256/{z}/{x}/{y}
REACT_APP_MAPBOX_STREETS_STYLE=https://api.mapbox.com/styles/v1/shivam-soni/ckvb1sp6h4svu15t5h7snxwgc/tiles/256/{z}/{x}/{y}
REACT_APP_MAPBOX_GREEN_STYLE=https://api.mapbox.com/styles/v1/shivam-soni/ckvb1tksh05ts14mxll1ykm7s/tiles/256/{z}/{x}/{y}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This must not be part of the code

.gitignore Outdated
@@ -8,7 +8,7 @@
/coverage

# production
/build
/build
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove extra space

.gitignore Outdated
@@ -23,7 +23,7 @@
.env.test.local
.env.production.local
.env
.env.development
.env.development
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove extra space

Comment on lines 117 to 146
<button
className="toggle"
onClick={e => onChangeBaseLayer('light', URL_UPDATE_PUSH)}
>
light
</button>
<button
className="toggle"
onClick={e => onChangeBaseLayer('dark', URL_UPDATE_PUSH)}
>
dark
</button>
<button
className="toggle"
onClick={e => onChangeBaseLayer('satelight', URL_UPDATE_PUSH)}
>
satelight
</button>
<button
className="toggle"
onClick={e => onChangeBaseLayer('street', URL_UPDATE_PUSH)}
>
street
</button>
<button
className="toggle"
onClick={e => onChangeBaseLayer('green', URL_UPDATE_PUSH)}
>
green
</button>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can have a single component for this and dynamically generate with help of a map function

import { getVectorContext } from 'ol/render';
import { Fill, Style, Stroke } from 'ol/style';

/**
* @param {*} rasterLayer = Raster layer map instance generated from OL map init
*/
export default function clipRasterLayer({ rasterLayer, shape }) {
//Create cliping layer from topojson
// console.log(`shape`, shape);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this

Comment on lines 63 to 67
// console.log(`baseMapLayerLoaded`, baseMapLayerLoaded);
baseMapLayer = baseMapLayerLoaded.baseMapLayer;
// console.log(`baseMapLayer`, baseMapLayer);
baseMapSource = baseMapLayerLoaded.baseMapSource;
// console.log(`baseMapSource`, baseMapSource);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove unnecessary console comments

Comment on lines 10 to 11
// console.log(`style`, style);
// console.log(`BASEMAP_LIGHT_STYLE`, BASEMAP_LIGHT_STYLE);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove unnecessary console comments

setSource(olInstances.map.getLayers().getArray()[0].values_.source);

if (olInstances.rasterSource && shape && prevTiles !== tiles) {
olInstances.rasterSource.setUrl(tiles);
olInstances.rasterSource.refresh();
}

if (olInstances.baseMapSource && baseLayer && prevBaseLayer !== baseLayer) {
// console.log(`prevBaseLayer`, prevBaseLayer, baseLayer);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove unnecessary console comments

import { Tile as TileLayer } from 'ol/layer';

export function baseMapLayerLoader(url) {
// console.log(`url`, url);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove unnecessary console comments

Comment on lines 1 to 17
import React from 'react';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faInfoCircle } from '@fortawesome/free-solid-svg-icons';
import 'react-tippy/dist/tippy.css';
import { Tooltip } from 'react-tippy';

const Tooltips = ({ tipinfo }) => {
return (
<div>
<Tooltip title={tipinfo} position="bottom" trigger="click">
<FontAwesomeIcon icon={faInfoCircle} />
</Tooltip>
</div>
);
};

export default Tooltips;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why tooltip code is part of this PR? It should be part of -

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this tooltip code from this PR
I think you branched it from that PR

@shivamSspirit
Copy link
Author

refactor all changes

@shivamSspirit
Copy link
Author

Review this

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants