Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Support custom layer to Maps #150

Merged

Conversation

junqiu-lei
Copy link
Member

@junqiu-lei junqiu-lei commented Dec 30, 2022

Signed-off-by: Junqiu Lei [email protected]

Description

Support custom layer to Maps.

Allow user to add TMS protocol and WMS protocol type raster tile to Maps. On this type of layer, user can select protocol type, add/update source under Data tab and basic layer setting under Setting tab like name, zoom range, opacity and description.

Demo

update_demo_1.mov

Issues Resolved

#149

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@junqiu-lei junqiu-lei requested a review from a team December 30, 2022 01:53
@junqiu-lei junqiu-lei self-assigned this Dec 30, 2022

const [customMapURL, setCustomMapURL] = useState<string>('');
const [customMapAttribution, setCustomMapAttribution] = useState<string>('');
const [protocol, setProtocol] = useState(customMapProtocolOptions[0].value);
Copy link
Member

Choose a reason for hiding this comment

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

nit:
Should we keep WMS as default? just for legacy

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, updated.

new URL(url);
return false;
} catch (e) {
return true;
Copy link
Member

Choose a reason for hiding this comment

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

Shall we include error message from exception?

Copy link
Member Author

Choose a reason for hiding this comment

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

this function It's only used to validate it's a valid URL not to validate it's map URL, we would just use it for EuiFormErrorText:
image

image

<EuiForm>
<EuiFlexGrid columns={1}>
<EuiFlexItem>
<EuiFormLabel>Protocol</EuiFormLabel>
Copy link
Member

Choose a reason for hiding this comment

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

I am thinking about calling it as "Custom type" . WDYT?

Copy link
Member Author

@junqiu-lei junqiu-lei Jan 3, 2023

Choose a reason for hiding this comment

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

yeah, updated

@VijayanB
Copy link
Member

VijayanB commented Jan 2, 2023

WMS from Coordinate maps looks like below, Shall we keep same fields/description?
Screen Shot 2023-01-01 at 9 35 48 PM

Comment on lines +103 to +106
export const referenceLayerTypeLookup = {
[DASHBOARDS_MAPS_LAYER_TYPE.OPENSEARCH_MAP]: true,
[DASHBOARDS_MAPS_LAYER_TYPE.CUSTOM_MAP]: true,
[DASHBOARDS_MAPS_LAYER_TYPE.DOCUMENTS]: false,
Copy link
Member

Choose a reason for hiding this comment

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

why not include this as property of Specification?

Copy link
Member Author

Choose a reason for hiding this comment

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

WMS from Coordinate maps looks like below, Shall we keep same fields/description? Screen Shot 2023-01-01 at 9 35 48 PM

Leaflet is using L.tileLayer.wms to constructs the right WMS call from it's parameters and then forwards it to WMS server

var wmsLayer = L.tileLayer.wms('http://ows.mundialis.de/services/service?', {
    layers: 'TOPO-OSM-WMS'
}).addTo(map);

but in maplibre(example), it doesn't have this kind of api call, we need explicitly pass parameters to it.

Copy link
Member

Choose a reason for hiding this comment

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

if it is not possible to abstract those extra parameters similar to leaflet, will go with what we have. Shall we mark what is required and optional as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, just updated, also added the help text to each parameter

Signed-off-by: Junqiu Lei <[email protected]>
Signed-off-by: Junqiu Lei <[email protected]>
Signed-off-by: Junqiu Lei <[email protected]>
Copy link
Member

@vamshin vamshin left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks

@junqiu-lei junqiu-lei merged commit 6dfdcbb into opensearch-project:feature/new-maps Jan 4, 2023
@junqiu-lei junqiu-lei deleted the custom_layer branch January 4, 2023 06:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants