Skip to content

Commit 5434459

Browse files
authored
Data update: Change feature layer renderer (#926)
1 parent 8a41912 commit 5434459

File tree

22 files changed

+140
-203
lines changed

22 files changed

+140
-203
lines changed

src/Android/Xamarin.Android/Samples/Layers/ChangeFeatureLayerRenderer/ChangeFeatureLayerRenderer.cs

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2018 Esri.
1+
// Copyright 2021 Esri.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
44
// You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0
@@ -25,7 +25,7 @@ namespace ArcGISRuntime.Samples.ChangeFeatureLayerRenderer
2525
name: "Change feature layer renderer",
2626
category: "Layers",
2727
description: "Change the appearance of a feature layer with a renderer.",
28-
instructions: "Use the buttons to change the renderer on the feature layer. The original renderer displays orange circles, the diameters of which are proportional to carbon storage of each tree. When the blue renderer in this sample is applied, it displays the location of the trees simply as blue points.",
28+
instructions: "Use the button in the control panel to change the renderer on the feature layer. The original renderer displays orange circles, the diameters of which are proportional to carbon storage of each tree. When the blue renderer in this sample is applied, it displays the location of the trees simply as blue points.",
2929
tags: new[] { "feature layer", "renderer", "visualization" })]
3030
public class ChangeFeatureLayerRenderer : Activity
3131
{
@@ -57,7 +57,7 @@ private void Initialize()
5757

5858
// Create and set initial map area
5959
Envelope initialLocation = new Envelope(
60-
-1.30758164047166E7, 4014771.46954516, -1.30730056797177E7, 4016869.78617381,
60+
-9177811, 4247000, -9176791, 4247784,
6161
SpatialReferences.WebMercator);
6262

6363
// Set the initial viewpoint for map
@@ -67,8 +67,7 @@ private void Initialize()
6767
_myMapView.Map = myMap;
6868

6969
// Create uri to the used feature service
70-
Uri serviceUri = new Uri(
71-
"https://sampleserver6.arcgisonline.com/arcgis/rest/services/PoolPermits/FeatureServer/0");
70+
Uri serviceUri = new Uri("https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Landscape_Trees/FeatureServer/0");
7271

7372
// Initialize feature table using a url to feature server url
7473
ServiceFeatureTable featureTable = new ServiceFeatureTable(serviceUri);
@@ -80,19 +79,11 @@ private void Initialize()
8079

8180
private void OnOverrideButtonClicked(object sender, EventArgs e)
8281
{
83-
// Create a symbol to be used in the renderer
84-
SimpleLineSymbol symbol = new SimpleLineSymbol()
85-
{
86-
Color = Color.Blue,
87-
Width = 2,
88-
Style = SimpleLineSymbolStyle.Solid
89-
};
90-
91-
// Create a new renderer using the symbol just created
92-
SimpleRenderer renderer = new SimpleRenderer(symbol);
82+
// Create a symbol to be used in the renderer.
83+
SimpleMarkerSymbol symbol = new SimpleMarkerSymbol(SimpleMarkerSymbolStyle.Circle, Color.Blue, 5);
9384

94-
// Assign the new renderer to the feature layer
95-
_featureLayer.Renderer = renderer;
85+
// Create and apply a new renderer using the symbol just created.
86+
_featureLayer.Renderer = new SimpleRenderer(symbol);
9687

9788
// Enable the reset button.
9889
_overrideButton.Enabled = false;
-61.3 KB
Loading

src/Android/Xamarin.Android/Samples/Layers/ChangeFeatureLayerRenderer/readme.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ A feature layer hosted on ArcGIS Online has a preset renderer and will display i
1010

1111
## How to use the sample
1212

13-
Use the buttons to change the renderer on the feature layer. The original renderer displays orange circles, the diameters of which are proportional to carbon storage of each tree. When the blue renderer in this sample is applied, it displays the location of the trees simply as blue points.
13+
Use the button in the control panel to change the renderer on the feature layer. The original renderer displays orange circles, the diameters of which are proportional to carbon storage of each tree. When the blue renderer in this sample is applied, it displays the location of the trees simply as blue points.
1414

1515
## How it works
1616

1717
1. Create a `ServiceFeatureTable` from a URL.
1818
2. Create a `FeatureLayer` from the service feature table.
1919
3. Create a new renderer (in this case, a `SimpleRenderer`).
20-
4. Change the feature layer's renderer using the `FeatureLayer.Renderer` property.
20+
4. Change the feature layer's renderer using the `FeatureLayer.Renderer` property.
2121

2222
## Relevant API
2323

@@ -27,8 +27,8 @@ Use the buttons to change the renderer on the feature layer. The original render
2727

2828
## About the data
2929

30-
This sample displays a feature layer in Riverside County, California, showing parcels of land and whether they have pool permits. Red polygons indicate parcels that do have permits.
30+
This sample displays a feature layer in Warren Wilson College, North Carolina, showing carbon storage of trees on campus. The size of each circle is proportional to that particular tree's carbon storage total.
3131

3232
## Tags
3333

34-
feature layer, renderer, visualization
34+
feature layer, renderer, visualization
-9.17 KB
Loading
Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="utf-8" ?>
2-
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
2+
<ContentPage x:Class="ArcGISRuntime.Samples.ChangeFeatureLayerRenderer.ChangeFeatureLayerRenderer"
3+
xmlns="http://xamarin.com/schemas/2014/forms"
34
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
4-
xmlns:esriUI="clr-namespace:Esri.ArcGISRuntime.Xamarin.Forms;assembly=Esri.ArcGISRuntime.Xamarin.Forms"
5-
x:Class="ArcGISRuntime.Samples.ChangeFeatureLayerRenderer.ChangeFeatureLayerRenderer">
5+
xmlns:esriUI="clr-namespace:Esri.ArcGISRuntime.Xamarin.Forms;assembly=Esri.ArcGISRuntime.Xamarin.Forms">
66
<Grid>
77
<Grid.RowDefinitions>
88
<RowDefinition Height="auto" />
@@ -12,8 +12,16 @@
1212
<ColumnDefinition Width="*" />
1313
<ColumnDefinition Width="*" />
1414
</Grid.ColumnDefinitions>
15-
<Button Clicked="OnResetButtonClicked" Text="Reset" Grid.Row="0" Grid.Column="0" />
16-
<Button Clicked="OnOverrideButtonClicked" Text="Override" Grid.Row="0" Grid.Column="1" />
17-
<esriUI:MapView x:Name="MyMapView" Grid.Row="1" Grid.ColumnSpan="2" />
15+
<Button Grid.Row="0"
16+
Grid.Column="0"
17+
Clicked="OnResetButtonClicked"
18+
Text="Reset" />
19+
<Button Grid.Row="0"
20+
Grid.Column="1"
21+
Clicked="OnOverrideButtonClicked"
22+
Text="Override" />
23+
<esriUI:MapView x:Name="MyMapView"
24+
Grid.Row="1"
25+
Grid.ColumnSpan="2" />
1826
</Grid>
1927
</ContentPage>

src/Forms/Shared/Samples/Layers/ChangeFeatureLayerRenderer/ChangeFeatureLayerRenderer.xaml.cs

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2016 Esri.
1+
// Copyright 2021 Esri.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
44
// You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0
@@ -21,7 +21,7 @@ namespace ArcGISRuntime.Samples.ChangeFeatureLayerRenderer
2121
name: "Change feature layer renderer",
2222
category: "Layers",
2323
description: "Change the appearance of a feature layer with a renderer.",
24-
instructions: "Use the buttons to change the renderer on the feature layer. The original renderer displays orange circles, the diameters of which are proportional to carbon storage of each tree. When the blue renderer in this sample is applied, it displays the location of the trees simply as blue points.",
24+
instructions: "Use the button in the control panel to change the renderer on the feature layer. The original renderer displays orange circles, the diameters of which are proportional to carbon storage of each tree. When the blue renderer in this sample is applied, it displays the location of the trees simply as blue points.",
2525
tags: new[] { "feature layer", "renderer", "visualization" })]
2626
public partial class ChangeFeatureLayerRenderer : ContentPage
2727
{
@@ -43,7 +43,7 @@ private void Initialize()
4343

4444
// Create and set initial map area
4545
Envelope initialLocation = new Envelope(
46-
-1.30758164047166E7, 4014771.46954516, -1.30730056797177E7, 4016869.78617381,
46+
-9177811, 4247000, -9176791, 4247784,
4747
SpatialReferences.WebMercator);
4848

4949
// Set the initial viewpoint for map
@@ -53,8 +53,7 @@ private void Initialize()
5353
MyMapView.Map = myMap;
5454

5555
// Create uri to the used feature service
56-
Uri serviceUri = new Uri(
57-
"https://sampleserver6.arcgisonline.com/arcgis/rest/services/PoolPermits/FeatureServer/0");
56+
Uri serviceUri = new Uri("https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Landscape_Trees/FeatureServer/0");
5857

5958
// Initialize feature table using a url to feature server url
6059
ServiceFeatureTable featureTable = new ServiceFeatureTable(serviceUri);
@@ -66,19 +65,11 @@ private void Initialize()
6665

6766
private void OnOverrideButtonClicked(object sender, EventArgs e)
6867
{
69-
// Create a symbol to be used in the renderer
70-
SimpleLineSymbol symbol = new SimpleLineSymbol()
71-
{
72-
Color = Colors.Blue,
73-
Width = 2,
74-
Style = SimpleLineSymbolStyle.Solid
75-
};
68+
// Create a symbol to be used in the renderer.
69+
SimpleMarkerSymbol symbol = new SimpleMarkerSymbol(SimpleMarkerSymbolStyle.Circle, Color.Blue, 5);
7670

77-
// Create a new renderer using the symbol just created
78-
SimpleRenderer renderer = new SimpleRenderer(symbol);
79-
80-
// Assign the new renderer to the feature layer
81-
_featureLayer.Renderer = renderer;
71+
// Create and apply a new renderer using the symbol just created.
72+
_featureLayer.Renderer = new SimpleRenderer(symbol);
8273
}
8374

8475
private void OnResetButtonClicked(object sender, EventArgs e)

src/Forms/Shared/Samples/Layers/ChangeFeatureLayerRenderer/readme.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ A feature layer hosted on ArcGIS Online has a preset renderer and will display i
1010

1111
## How to use the sample
1212

13-
Use the buttons to change the renderer on the feature layer. The original renderer displays orange circles, the diameters of which are proportional to carbon storage of each tree. When the blue renderer in this sample is applied, it displays the location of the trees simply as blue points.
13+
Use the button in the control panel to change the renderer on the feature layer. The original renderer displays orange circles, the diameters of which are proportional to carbon storage of each tree. When the blue renderer in this sample is applied, it displays the location of the trees simply as blue points.
1414

1515
## How it works
1616

1717
1. Create a `ServiceFeatureTable` from a URL.
1818
2. Create a `FeatureLayer` from the service feature table.
1919
3. Create a new renderer (in this case, a `SimpleRenderer`).
20-
4. Change the feature layer's renderer using the `FeatureLayer.Renderer` property.
20+
4. Change the feature layer's renderer using the `FeatureLayer.Renderer` property.
2121

2222
## Relevant API
2323

@@ -27,8 +27,8 @@ Use the buttons to change the renderer on the feature layer. The original render
2727

2828
## About the data
2929

30-
This sample displays a feature layer in Riverside County, California, showing parcels of land and whether they have pool permits. Red polygons indicate parcels that do have permits.
30+
This sample displays a feature layer in Warren Wilson College, North Carolina, showing carbon storage of trees on campus. The size of each circle is proportional to that particular tree's carbon storage total.
3131

3232
## Tags
3333

34-
feature layer, renderer, visualization
34+
feature layer, renderer, visualization
-13 KB
Loading
Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,20 @@
1-
<UserControl
2-
x:Class="ArcGISRuntime.UWP.Samples.ChangeFeatureLayerRenderer.ChangeFeatureLayerRenderer"
3-
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5-
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6-
xmlns:esri="using:Esri.ArcGISRuntime"
7-
xmlns:esriUI="using:Esri.ArcGISRuntime.UI.Controls"
8-
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
9-
d:DesignHeight="300"
10-
d:DesignWidth="300"
11-
mc:Ignorable="d">
1+
<UserControl x:Class="ArcGISRuntime.UWP.Samples.ChangeFeatureLayerRenderer.ChangeFeatureLayerRenderer"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:esriUI="using:Esri.ArcGISRuntime.UI.Controls">
125
<Grid>
136
<Grid.RowDefinitions>
147
<RowDefinition Height="auto" />
158
<RowDefinition Height="*" />
169
</Grid.RowDefinitions>
1710
<CommandBar Grid.Row="0" OverflowButtonVisibility="Collapsed">
18-
<AppBarButton
19-
Name="Reset"
20-
Click="OnResetButtonClicked"
21-
Content="Reset" />
22-
<AppBarButton
23-
Name="ApplyRenderer"
24-
Click="OnOverrideButtonClicked"
25-
Content="Override" />
11+
<AppBarButton Name="Reset"
12+
Click="OnResetButtonClicked"
13+
Content="Reset" />
14+
<AppBarButton Name="ApplyRenderer"
15+
Click="OnOverrideButtonClicked"
16+
Content="Override" />
2617
</CommandBar>
2718
<esriUI:MapView x:Name="MyMapView" Grid.Row="1" />
2819
</Grid>
29-
</UserControl>
30-
20+
</UserControl>

src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Layers/ChangeFeatureLayerRenderer/ChangeFeatureLayerRenderer.xaml.cs

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2016 Esri.
1+
// Copyright 2021 Esri.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
44
// You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0
@@ -21,7 +21,7 @@ namespace ArcGISRuntime.UWP.Samples.ChangeFeatureLayerRenderer
2121
name: "Change feature layer renderer",
2222
category: "Layers",
2323
description: "Change the appearance of a feature layer with a renderer.",
24-
instructions: "Use the buttons to change the renderer on the feature layer. The original renderer displays orange circles, the diameters of which are proportional to carbon storage of each tree. When the blue renderer in this sample is applied, it displays the location of the trees simply as blue points.",
24+
instructions: "Use the button in the control panel to change the renderer on the feature layer. The original renderer displays orange circles, the diameters of which are proportional to carbon storage of each tree. When the blue renderer in this sample is applied, it displays the location of the trees simply as blue points.",
2525
tags: new[] { "feature layer", "renderer", "visualization" })]
2626
public partial class ChangeFeatureLayerRenderer
2727
{
@@ -43,7 +43,7 @@ private void Initialize()
4343

4444
// Create and set initial map area
4545
Envelope initialLocation = new Envelope(
46-
-1.30758164047166E7, 4014771.46954516, -1.30730056797177E7, 4016869.78617381,
46+
-9177811, 4247000, -9176791, 4247784,
4747
SpatialReferences.WebMercator);
4848

4949
// Set the initial viewpoint for map
@@ -53,8 +53,7 @@ private void Initialize()
5353
MyMapView.Map = myMap;
5454

5555
// Create uri to the used feature service
56-
Uri serviceUri = new Uri(
57-
"https://sampleserver6.arcgisonline.com/arcgis/rest/services/PoolPermits/FeatureServer/0");
56+
Uri serviceUri = new Uri("https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Landscape_Trees/FeatureServer/0");
5857

5958
// Initialize feature table using a url to feature server url
6059
ServiceFeatureTable featureTable = new ServiceFeatureTable(serviceUri);
@@ -66,19 +65,11 @@ private void Initialize()
6665

6766
private void OnOverrideButtonClicked(object sender, RoutedEventArgs e)
6867
{
69-
// Create a symbol to be used in the renderer
70-
SimpleLineSymbol symbol = new SimpleLineSymbol()
71-
{
72-
Color = Color.Blue,
73-
Width = 2,
74-
Style = SimpleLineSymbolStyle.Solid
75-
};
68+
// Create a symbol to be used in the renderer.
69+
SimpleMarkerSymbol symbol = new SimpleMarkerSymbol(SimpleMarkerSymbolStyle.Circle, Color.Blue, 5);
7670

77-
// Create a new renderer using the symbol just created
78-
SimpleRenderer renderer = new SimpleRenderer(symbol);
79-
80-
// Assign the new renderer to the feature layer
81-
_featureLayer.Renderer = renderer;
71+
// Create and apply a new renderer using the symbol just created.
72+
_featureLayer.Renderer = new SimpleRenderer(symbol);
8273
}
8374

8475
private void OnResetButtonClicked(object sender, RoutedEventArgs e)

0 commit comments

Comments
 (0)