POST
|
I have an app that allows a user to create/edit features in a map using the JS API. My feature service is secured. However, I have to use a proxy because the end users require that there be no login to access the app. Everything works fine in IE, but in Chrome and Firefox I get the standard "Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at..." message. I also get some ambiguous Object error when I try to add a feature to the map. The odd thing is the feature still gets written back to the feature service despite the error and it failing to display on the map until the page or service is refreshed. I have CORS enabled on my webservers. My ArcGIS Servers are on an internal domain separate from my webservers that are on a DMZ. My proxy.ashx is working. There's lots of information about this kind of stuff out there, but nothing I try seems to work. Anyone have a suggestion??? Also, I'm not really sure what information to include here so if more is required please let me know! //esriConfig.defaults.io.corsDetection = true;
//esriConfig.defaults.io.alwaysUseProxy = true;
//esriConfig.defaults.io.corsEnabledServers.push("gis.logis.org");
//esriConfig.defaults.io.useCors = false;
//Send requests to ArcGIS Server through the proxy. This prevents users from having to log in.
if (cityFolder != null) {
esriurlUtils.addProxyRule({
proxyUrl: "https://...",
urlPrefix: cityFolder
//urlPrefix: "..."
});
//esriConfig.defaults.io.proxyUrl = "...";
}
... View more
05-06-2015
07:24 AM
|
0
|
2
|
5738
|
POST
|
atomaras, This indeed works.. Excellent workaround! Thank for the suggestion.
... View more
03-21-2014
06:38 AM
|
0
|
0
|
325
|
POST
|
Did this ever work for you? Nope. I'm pretty confident it's an issue with the Map control though. I'm hoping someone from ESRI can shed some light on this.
... View more
03-03-2014
11:22 AM
|
0
|
0
|
325
|
POST
|
I'm having a binding problem with the Map control when referencing a map I defined in XAML. I have a situation where I need to use nested TabControls that all reference the same map via element binding. <Grid x:Name="LayoutRoot"> <esri:Map x:Name="map_TestMap" WrapAround="True"> <esri:ArcGISTiledMapServiceLayer Url="http://services.arcgisonline.com:80/ArcGIS/rest/services/World_Street_Map/MapServer"/> </esri:Map> <sdk:TabControl x:Name="tc_1" HorizontalAlignment="Right" Width="300"> <sdk:TabItem x:Name="ti_1" Header="TabItem 1"> <!--<nestedTabControlControls:TestControl x:Name="test_4" VerticalAlignment="Top" Map="{Binding ElementName=map_TestMap}"/>--> <sdk:TabControl x:Name="tc_2"> <sdk:TabItem x:Name="ti_Nested1" Header="Nested TabItem 1"> <nestedTabControlControls:TestControl x:Name="test_1" VerticalAlignment="Top" Map="{Binding ElementName=map_TestMap}"/> </sdk:TabItem> <sdk:TabItem x:Name="ti_Nested2" Header="Nested TabItem 2"> <nestedTabControlControls:TestControl x:Name="test_2" VerticalAlignment="Top" Map="{Binding ElementName=map_TestMap}"/> </sdk:TabItem> </sdk:TabControl> </sdk:TabItem> <sdk:TabItem x:Name="ti_2" Header="TabItem 2"> <nestedTabControlControls:TestControl x:Name="test_3" VerticalAlignment="Top" Map="{Binding ElementName=map_TestMap}"/> </sdk:TabItem> </sdk:TabControl> </Grid> Everything above works fine except for the last TestControl (test_3) does not get a value for the property "Map". It's null. However, if I comment out the nested TabControl (tc_2) and uncomment TestControl "test_4" everything will work as expected. There seems to be something with element binding to the map in a nested TabControl that prevents element binding to the map on subsequent controls. Any ideas? TestControl: using System.Windows; using System.Windows.Controls; using ESRI.ArcGIS.Client; namespace NestedTabControl.Controls { [TemplatePart(Name = TestControl.MapNameElementName, Type = typeof(TextBlock))] public class TestControl : Control { private const string MapNameElementName = "txt_Map"; public const string MapPropertyName = "Map"; public TestControl() { this.DefaultStyleKey = typeof(TestControl); } private TextBlock _txtMap; public static readonly DependencyProperty MapProperty = DependencyProperty.Register(MapPropertyName, typeof(Map), typeof(TestControl), new PropertyMetadata(OnMapPropertyChanged)); private static void OnMapPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { (d as TestControl).OnMapPropertyChanged(e.NewValue, e.OldValue); } private void OnMapPropertyChanged(object newValue, object oldValue) { if (_txtMap != null) _txtMap.Text = ((Map)newValue).Name; } public override void OnApplyTemplate() { base.OnApplyTemplate(); _txtMap = GetTemplateChild(MapNameElementName) as TextBlock; } public Map Map { get { return (Map)GetValue(MapProperty); } set { SetValue(MapProperty, value); } } } }
... View more
02-14-2014
07:35 AM
|
0
|
5
|
616
|
POST
|
Does anyone know why the IdentityManager.Current.FindServerInfo() method always returns null in the following code?
using System.Windows.Controls;
using ESRI.ArcGIS.Client;
namespace DebugTest
{
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
IdentityManager.ServerInfo serverInfo = IdentityManager.Current.FindServerInfo("https://gis1.logis.org/arcgis");
}
}
}
... View more
12-06-2012
10:07 AM
|
0
|
1
|
1992
|
POST
|
yeah, it only happens sometimes, but once it happens it will continue until i clear the cache. i haven't really tested it with another service though and i'm using v2.5. i can give v3.0 a shot and see if that solves the problem.
... View more
06-11-2012
06:54 AM
|
0
|
0
|
292
|
POST
|
i'm using v2.4 and the sl4. it's really weird, sometimes it works. sometimes it doens't. i've completely stripped my code down to just what i have in my initial thread, and that's all it takes to raise the exception.
... View more
06-07-2012
08:53 AM
|
0
|
0
|
344
|
POST
|
I keep getting an apparently random error on the GetAllDetails method of the ArcGISDynamicMapServiceLayer object. The error message doesn't tell me anything useful about what the problem is and it only happens some of the time. The only way that I've been able to resolve the error is by clearing the the cache in the ArcGIS REST API Admin console everytime it happens. Anyone have an idea of what the problem could be here?
... View more
06-07-2012
06:09 AM
|
0
|
4
|
792
|
POST
|
Sounds like I have the same issue as in the other thread. I'm not even adding a service to my map object and it still causes the error in Blend. Just simply adding an empty map to the xaml is what evidently throws the exception in Blend. Is there a resolution for this?
... View more
06-07-2012
05:37 AM
|
0
|
0
|
344
|
POST
|
i'm actually using v2.4 and sl4. what's really strange, is that sometimes the app works in blend and other times i get the error.
... View more
05-22-2012
10:02 AM
|
0
|
0
|
344
|
POST
|
I'm getting a Xaml Parse Exception in Blend whenever I try to add a Map control. Anyone know how to fix this? <UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:esri="http://schemas.esri.com/arcgis/client/2009"
x:Class="MapCheck.MainPage"
Width="640" Height="480">
<Grid x:Name="LayoutRoot" Background="White">
<esri:Map>
</esri:Map>
</Grid>
</UserControl>
... View more
05-18-2012
11:35 AM
|
0
|
7
|
808
|
POST
|
I'm getting a null reference exception on my Editor. The Layers property in my Map is databound to my view model and removing this property from the Map seems to eliminate the error, so I'm thinking the Editor control won't work with a Map that has databound layers. Is this true? Does anybody know of a workaround for this? Here's the error: System.NullReferenceException Object reference not set to an instance of an object. at ESRI.ArcGIS.Client.Editor.OnMapPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) at System.Windows.DependencyObject.RaisePropertyChangeNotifications(DependencyProperty dp, Object oldValue, Object newValue) at System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation) at System.Windows.DependencyObject.RefreshExpression(DependencyProperty dp) at System.Windows.Data.BindingExpression.SendDataToTarget() at System.Windows.Data.BindingExpression.SourceAcquired() at System.Windows.Data.BindingExpression.InheritanceContextChanged(Object sender, EventArgs e) at System.EventHandler.Invoke(Object sender, EventArgs e) at System.Windows.DependencyObject.OnInheritanceContextChanged(Object sender, EventArgs e) at MS.Internal.JoltHelper.<>c__DisplayClass4.<RaiseEvent>b__1() <UserControl.Resources>
<ResourceDictionary>
<esri:Editor x:Key="IdentifyEditor" Map="{Binding ElementName=map_BaseMap}" LayerIDs="{Binding Path=SelectLayer}"/>
</ResourceDictionary>
</UserControl.Resources>
<Grid x:Name="LayoutRoot">
<esri:Map x:Name="map_BaseMap" Layers="{Binding Path=MapLayers}" MinimumResolution=".25">
<esri:Map.Extent>
<esri:Envelope XMin="-10510990.377700" YMin="5586273.272800" XMax="-10364472.557100" YMax="5682307.505400">
<esri:Envelope.SpatialReference>
<esri:SpatialReference WKID="102100"/>
</esri:Envelope.SpatialReference>
</esri:Envelope>
</esri:Map.Extent>
</esri:Map>
... View more
10-26-2011
10:05 AM
|
0
|
1
|
464
|
POST
|
Darina & Brandon, Thanks for all the great information, I have it working now! Hopefully this will spark some new conversations about MVVM here, it's new to me as well. I'm in the process of writing a rather large application using MVVM for the first time. I like it, but there are quite a few challenges to overcome. Thanks, Ben
... View more
10-14-2011
07:39 AM
|
0
|
0
|
904
|
POST
|
I have my ChangePropertyAction setup, but I think I'm still missing something because I can't get it to work. It looks like the VM property (Coordinates) is never being set by the action. I'm new to MVVM and actions in general, so perhaps I'm totally missing how this is suppose to work. Or I'm just missing something really obvious. Thanks for the help! <UserControl x:Class="MVVM_Debug.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:interactivity="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:interactions="http://schemas.microsoft.com/expression/2010/interactions"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:esri="http://schemas.esri.com/arcgis/client/2009"
xmlns:command="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.SL4"
xmlns:actions="clr-namespace:MVVM_Debug.Actions"
xmlns:behaviors="clr-namespace:MVVM_Debug.Behaviors"
xmlns:controls="clr-namespace:MVVM_Debug.Controls"
xmlns:helpers="clr-namespace:MVVM_Debug.Helpers"
xmlns:toolkit="clr-namespace:MVVM_Debug.Toolkit"
mc:Ignorable="d" d:DesignHeight="600" d:DesignWidth="800"
DataContext="{Binding Main, Source={StaticResource Locator}}">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Skins/MainSkin.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid x:Name="LayoutRoot">
<esri:Map x:Name="map_BaseMap" Layers="{Binding Path=MapLayers}" helpers:MapHelper.ZoomGeometry="{Binding Path=MapExtent}" MinimumResolution=".25">
<esri:Map.Extent>
<esri:Envelope XMin="-10510990.377700" YMin="5586273.272800" XMax="-10364472.557100" YMax="5682307.505400">
<esri:Envelope.SpatialReference>
<esri:SpatialReference WKID="102100"/>
</esri:Envelope.SpatialReference>
</esri:Envelope>
</esri:Map.Extent>
<interactivity:Interaction.Triggers>
<interactivity:EventTrigger EventName="MouseMove">
<actions:MouseCoordinateAction TargetObject="{Binding Path=DataContext, ElementName=LayoutRoot}"
PropertyName="{Binding Path=Coordinates}"/>
</interactivity:EventTrigger>
</interactivity:Interaction.Triggers>
</esri:Map>
<controls:LogisNavigation Margin="5" Map="{Binding ElementName=map_BaseMap}" FullExtentGeometry="{Binding Path=FullExtent}"
InitialExtentGeometry="{Binding Path=InitialExtent}" helpers:NavigationHelper.ZoomReset="{Binding Path=MapExtent}"
Background="Gray" BorderBrush="White" Foreground="Black"/>
<esri:MapProgressBar HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="0,0,0,5" Width="150" Map="{Binding ElementName=map_BaseMap}"/>
<controls:LogisScaleBar HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="5" Width="200" MapUnit="Meters"
Map="{Binding ElementName=map_BaseMap}"/>
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Top" Margin="5" Foreground="White" Text="{Binding Path=Coordinates.X, StringFormat=\{0:F4\}}"/>
</Grid>
</UserControl> using System.Windows;
using System.Windows.Input;
using ESRI.ArcGIS.Client;
using ESRI.ArcGIS.Client.Geometry;
using ESRI.ArcGIS.Client.Projection;
using Microsoft.Expression.Interactivity.Core;
namespace MVVM_Debug.Actions
{
public class MouseCoordinateAction : ChangePropertyAction
{
protected override void Invoke(object parameter)
{
this.Value = GetLatLon(parameter as MouseEventArgs);
base.Invoke(parameter);
}
private MapPoint GetLatLon(MouseEventArgs e)
{
Map map = AssociatedObject as Map;
Point mouseLoc = e.GetPosition(map);
MapPoint coordLoc = map.ScreenToMap(mouseLoc);
if (coordLoc != null && coordLoc.Extent.SpatialReference.WKID == 102100)
{
WebMercator webMercator = new WebMercator();
MapPoint latLon = webMercator.ToGeographic(coordLoc) as MapPoint;
return latLon;
}
else
return null;
}
}
}
... View more
10-14-2011
06:49 AM
|
0
|
0
|
904
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|