Select to view content in your preferred language

Layers added in Map1 is not available in second Map 2, Compare Map view

409
2
11-03-2023 04:33 AM
SaurabhUpadhyaya
Frequent Contributor

Hi Team,

I am working on compare map view( Map1 & Map2) on single screen using ArcGIS JS API 4.27.

First I added layers on Map1 and its working fine, and on compare button open second map Map2 and trying to add previously added Layers on Map1 into Map2.  But Layers are now added in Map2 but it is removed from Map1. Why?

I do not want to create 2 Layers for each Map1 & Map2.

My requirement is to add Layers which already added in Map1 into Map2 and it should not be removed from Map1.

 

Tags (1)
0 Kudos
2 Replies
ReneRubalcava
Honored Contributor

A single layer instance can only be placed in one map. But a single map can be used in multiple views.

Here is an example from the samples in the docs.

https://developers.arcgis.com/javascript/latest/sample-code/views-composite-views/

0 Kudos
SaurabhUpadhyaya
Frequent Contributor

We are working on ArcGIS JS API 4.28 and using MapImageLayer and join-table with standalone table and join is working perfectly.

We are facing the issue in displaying the Label on this joined map image layer but label is not displaying.

I am sharing the code - 

var queryString =
"SELECT id,name from test";
const layer = new MapImageLayer({
url: "https://sample/MapServer",
title: "United States Population",
sublayers: [
{
title: "Share of population with Norwegian Ancestry",
id: 0,
labelingInfo: [
{
labelExpression: "[name]",
labelPlacement: "always-horizontal",
symbol: {
type: "text", // autocasts as new TextSymbol()
color: [255, 255, 255, 0.7],
haloColor: [0, 0, 0, 0.7],
haloSize: 1,
font: {
size: 11,
},
},

},
],

opacity: 0.75,
source: {
type: "data-layer",
dataSource: {
type: "join-table",
leftTableSource: {
type: "map-layer",
mapLayerId: 0,
},
rightTableSource: {
type: "data-layer",
dataSource: {
type: "query-table",
workspaceId: "testworkspace",
query: queryString,
oidFields: "id",
},
},
leftTableKey: "name",
rightTableKey: "name",
joinType: "left-outer-join",
},
},
},
],
});

Now I want to know how to display the label on joined tables?? and also want to know which fields will be displayed(Map Layer or System Table).. what is the syntax.

0 Kudos