|
POST
|
Foram, Instead of panning all the way to the min or max of the current extent, you might try using a fraction of the extent's width. Example below shifts it 1/4 east or west Envelope extent = MyMap.Extent; MapPoint center = extent.GetCenter(); if (e.Key.ToString().ToUpper() == "LEFT") { MyMap.PanTo(new MapPoint(center.X - (extent.Width/4), center.Y)); } else if (e.Key.ToString().ToUpper() == "RIGHT") { MyMap.PanTo(new MapPoint(center.X + (extent.Width/4), center.Y)); }
... View more
08-17-2012
02:07 PM
|
0
|
0
|
526
|
|
POST
|
I'm thinking about making a tool for my Silverlight app similar to the functionality of the 'Add BaseMap' button in ArcMap. Watching the http requests in Fiddler while clicking that button in ArcMap you can see it makes calls to arcgis.com, similar to how ArcGIS Explorer Desktop does (specifically this - http://www.arcgis.com/sharing/search?f=json&sortField=name&sortOrder=asc&num=50&q=group:34ca4e3505f24c1f90ac559ea23a5bed%20AND%20(typekeywords:%22image%20service%22%20OR%20typekeywords:%22layer%20package%22%20OR%20typekeywords:%22map%20service%22) This request returns a nice bit of JSON of the basemaps available, including a link to the thumbnail image which would be perferct for my idea. Anyone know if there are any restrictions against using this kind of info from ArcGIS.com? Thanks, Terry
... View more
08-17-2012
02:00 PM
|
0
|
7
|
1375
|
|
POST
|
What I've done is set the DrawMode to Point and then put the text the user types in a textbox at that point - code snippet below. Might work for other DrawMode geometry types too, just haven't tried it.
void Draw_DrawComplete(object sender, DrawEventArgs e)
{
GraphicsLayer gl = _Map.Layers[_glayer] as GraphicsLayer;
if (_bolText) //if user selected text from drawing options
{
(_symbol as TextSymbol).Text = txtText.Text;
txtText.Text = string.Empty;
spText.Visibility = Visibility.Collapsed;
}
Graphic g = new Graphic()
{
Geometry = e.Geometry,
Symbol = _symbol
};
gl.Graphics.Add(g);
gl.Refresh();
_Draw.IsEnabled = false;
_Draw.DrawMode = DrawMode.None;
}
... View more
07-30-2012
12:34 PM
|
0
|
0
|
1919
|
|
POST
|
Thank you for the information Dominique. I'm still using 2.3 at this time - we're just starting to install & test 10.1 but may move the API to v3.0 to get this working. In the meantime, it looks like I can hit www.arcgis.com/sharing/content/items/<Item ID>/data?f=json to grab what I need and update the legend control. Thanks again, Terry edit - here's the code to implement my idea above
webMap = new Document();
webMap.GetMapCompleted += (s, a) =>
{
if (a.Error == null)
{
MyMap.Extent = a.Map.Extent;
WebClient web = new WebClient();
web.OpenReadCompleted += (send, arg) =>
{
JsonObject jsObj = (JsonObject)JsonObject.Load(arg.Result);
if (jsObj.ContainsKey("error"))
{
return;
}
if (jsObj.ContainsKey("operationalLayers"))
{
JsonArray layers = (JsonArray)jsObj["operationalLayers"];
foreach (JsonObject jOb in layers)
{
if (jOb.ContainsKey("itemId"))
{
try
{
MyMap.Layers[jOb["itemId"]].ID = jOb["title"];
}
catch { }
}
else if (jOb.ContainsKey("id"))
{
try
{
MyMap.Layers[jOb["id"]].ID = jOb["title"];
}
catch { }
}
}
}
if (jsObj.ContainsKey("baseMap"))
{
JsonObject jOb = (JsonObject)jsObj["baseMap"];
if (jOb.ContainsKey("baseMapLayers"))
{
try
{
MyMap.Layers[jOb["baseMapLayers"][0]["id"]].ID = jOb["title"];
}
catch { }
}
}
};
web.OpenReadAsync(new Uri("http://www.arcgis.com/sharing/content/items/" + mapservice.MapServiceName + "/data?f=json"));
LayerCollection layerCollection = new LayerCollection();
foreach (Layer lyr in a.Map.Layers)
{
layerCollection.Add(lyr);
lyr.InitializationFailed += Layer_InitializationFailed;
}
a.Map.Layers.Clear();
MyMap.Layers = layerCollection;
... View more
07-17-2012
07:13 AM
|
0
|
0
|
1263
|
|
POST
|
I'm using code similar to the Load WebMap sample here and have a question. When I add the layers from the WebMap to my map, the Legend control associated with my map shows GUIDs for the various layer names. Is there some way to get the names as shown both in the description in ArcGIS.com and the ArcGIS.com map viewer? I want the 'nice' names as shown in the map description - [ATTACH=CONFIG]16139[/ATTACH] Not the IDs that seem to come across from GetMapAsync [ATTACH=CONFIG]16140[/ATTACH] Thanks, Terry
... View more
07-16-2012
01:53 PM
|
0
|
2
|
2648
|
|
POST
|
Hi Ravi, Yes, I manually cleared the cache while testing this. I also have the cache set to clear daily and I still don't see the data exclusion symbol. The Map Service is coming from a MSD file, would that make a difference vs. a MXD powered service? Thanks again, Terry
... View more
05-10-2012
09:11 AM
|
0
|
0
|
940
|
|
POST
|
I have a layer in a map service where the symbology includes an excluded data value (in ArcMap, it's a graduated symbol with manual classes defined on a numeric field. I used the data exclusion dialog to exclude Nulls and have a symbol set for that too - see attached) but it does not show up in the REST endpoint legend or in the Silverlight Legend control. Is this a known limitation of the REST legend or a bug? I'm running v10.0 SP4. I've tried restarting the service & clearing the REST cache but the symbol still doesn't show up. Thanks, Terry [ATTACH=CONFIG]13638[/ATTACH]
... View more
04-18-2012
08:48 AM
|
0
|
3
|
3424
|
|
POST
|
Thanks for the suggestion Dominique. I've checked and all debug options are turned on in the web project. I've also tried various combinations of the debug options (tools -> options -> debug node) suggested on StackOverflow and other forums to no avail.... I installed SP1 and rebooted; I ran devenv /ResetSettings from the command line I've even tried pulling the last good version from MS SourceSafe from when I last touched the solution and still get the same behavior. -update- I reinstalled VS2010 and still see the same behavior. Created a new SL project with no Esri references and get the same problem. I pulled my mapping SL project from SourceSafe onto another machine (WinXP) and I can debug normally. Something on my Win7 box has changed in the last month and is not allowing for SL debugging. Any other ideas? Thanks, Terry
... View more
03-23-2012
06:30 AM
|
0
|
0
|
1077
|
|
POST
|
I just hit this problem yesterday too. I can use F10 (step over) and F11 (step through) in other projects, such as a C# console app that converts an XLS to a featureclass but not in my Silverlight project. I know this is kind of beyond the scope of Esri, but any help would be appreciated. Running Win7 64bit, VS 2010 (installing SP1 now), Silverlight API 2.3, debugging in IE9 Thanks, TG
... View more
03-22-2012
09:46 AM
|
0
|
0
|
1077
|
|
POST
|
I have security enabled on my ArcGIS server and a very limited # of users who can access FeatureServices, but I'd like to set it up so no one can edit a FeatureService Layer through the links at the bottom of the REST endpoints (e.g. http://myserver/arcgis/rest/services/aservice/FeatureServer/0, "Supported Operations" links at the bottom). Is there a way to disable or remove these links? If so, which config file do I need to edit? If this is not possible, is turning off the entire Services directory the only other option? Thanks, Terry
... View more
01-13-2012
05:49 AM
|
0
|
1
|
2005
|
|
POST
|
Hello, I think you have 2 problems here - 1. I think your logic is off in your code. You're checking to see if the map is in Geographic (srid = 4326) and if it is, creating a new point with the same coords as the map point but defining the new points projection as UTM Zone 40 (srid =32640). I think you want to check if your map is not in geographic, e.g (mapa.SpatialReference.WKID != 4326) 2. In the project complete from the geometry service, if you're projecting the point to 4326, the units are in decimal degrees. It's easy to conver that to Degree Minutes Seconds with some quick math... A quick Google search yielded this -http://geography.about.com/library/howto/htdegrees.htm for example. Hope this helps, Terry
... View more
10-26-2011
08:47 AM
|
0
|
0
|
694
|
|
POST
|
Might not be exactly what you're looking for but you can call methods in the Silverlight classes from JavaScript, if you flag the class with the ScriptableType() attribute & flag the method(s) you want exposed to JavaScript with the ScriptableMethod() attribute. Silverlight objects can also call JS functions in your webpage via the ScriptObject class. calling JS function from within SL-
// in SL code behind -
ScriptObject js = (ScriptObject)HtmlPage.Window.GetProperty("some_js_function");
js.InvokeSelf("called from SL");
//Javascript in page -
function some_js_function(arg) {
alert(arg.toString());
}
Call SL method from JavaScript
// JS function in the page, called by a button's onclick
function Call_SL_Method(arg) {
var sl = document.getElementById("silverlightControl");
sl.content.Page.SetUserName(arg);
}
//in Silverlight Code Behind, decorate the class & method to expose to JS
[ScriptableType()]
public partial class MainPage : UserControl
{
[ScriptableMember()]
public void SetUserName(string name)
{
//txtName is a textblock to hold user name
txtName.Text = name;
}
public MainPage()
{
InitializeComponent();
//register the class with the HtmlPage
HtmlPage.RegisterScriptableObject("Page", this);
....
}
... View more
10-24-2011
10:32 AM
|
0
|
0
|
441
|
|
POST
|
Chris, You don't need ArcGIS Server installed to use the Silverlight API - you can use your WMS services and/or map services from other providers, such as ESRI's ArcGIS online. "Is the API free" - well, in general I'd say yes, but encourage you to read the License Agreement when you download it to make sure you intended use meets their terms.
... View more
10-24-2011
06:41 AM
|
0
|
0
|
508
|
|
POST
|
Chris, The ESRI silverlight toolkit contains a class for displaying WMS services - see http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#WmsLayerSimple for a sample and CodePlex to download the toolkit - http://esrisilverlight.codeplex.com/documentation. I've never looked at the source code for the toolkit but I'm guessing it handles all of the GetMap requests for you.. One thing to note though is that the WMSLayer class in the toolkit does not support the ability to Identify (GetFeatureInfo in WMS terms) on a WMS layer. I implemented my own WCF service to handle this which was pretty straight forward - - Pass the info (e.g. map extent, spatial reference, layers to query, etc...) you need to perfrom a WMS GetFeatureInfo request** from the Silverlight client to the service; - in the WCF service, build a URL containing the GetFeatureInfo request and use WebClient.OpenRead() to stream the results. -pass back to the client the results and handle as needed. **Note there are differences between WMS versions on the required parameters, their names, and for the BBox, the order of the parameters. I found a nice summary table between versions 1.1 and 1.3 somewhere on either the OGC or ESRI website, but don't recall where. Hope this helps, Terry
... View more
10-21-2011
01:27 PM
|
0
|
0
|
508
|
|
POST
|
Hi Percy, On that server, when I upgraded from ArcGIS Server 9.3.1 to 10.0, the issue described above stopped happening. Never did find the real reason for the behavior though, sorry.
... View more
10-06-2011
06:02 AM
|
0
|
0
|
235
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 10-23-2017 08:59 AM | |
| 1 | 06-15-2016 03:27 PM | |
| 1 | 01-14-2016 09:55 AM | |
| 2 | 12-14-2012 09:38 AM | |
| 2 | 10-23-2017 01:22 PM |
| Online Status |
Offline
|
| Date Last Visited |
07-17-2024
08:14 PM
|