|
POST
|
Part of my addin is trying to connect to what could be a SDE connection. I'm using WorkspaceFactory.OpenfromFile to connect to the geodatabase, because the connection could be to a file geodatabase, personal geodatabase, or an sde connection. Here's where my error is coming in. When I set the location of my connection file to the absolute location (C:\Users\ ... \ArcCatalog\myGIS.sde), it connects fine. But when I set it to "Database Connections\myGIS.sde", which is the location I get when I use the ArcCatalog dialog to browse to the geodatabase, the connection throws an error. Is there a way to get the file location for the database connection file programmatically? I want to use OpenFromFile because I don't want to handle user names and passwords, and because I can open other geodatabases with the same code. Here's an edited snippet of my code: ' code works when connection = "C:\Users\ ... \ArcCatalog\myGIS.sde" Dim connection as String = "Database Connections\myGIS.sde" Dim myWorkspace as IWorkspace Dim factoryType as Type = Type.GetTypeFromProgID("esriDataSourcesGDB.SdeWorkspaceFactory") Dim myWorkspaceFactory = Ctype(Activator.CreateInstance(factoryType), IWorkspaceFactory) myWorkspace = myWorkspaceFactory.OpenFromFile(connection, 0) ' here is where I get the error.
... View more
09-25-2012
07:53 AM
|
0
|
1
|
1110
|
|
POST
|
Thanks for the help. I figured out that if you add columns using DataGridTemplateColumn, but keep AutoGenerateColumns = True, it autogenerates the columns after the columns you hard code. Also, if you want a specific column first, and you know it's always going to be in your results, you can hard code it, then use the AutoGeneratingColumn function to cancel that column when it's autogenerated. [HTML] <esri:FeatureDataGrid x:Name="MyDataGrid" AutoGenerateColumns="True" Map="{Binding ElementName=MyMap}" GraphicsLayer="{Binding ElementName=MyMap, Path=Layer[myGraphicsLayer]}"> <esri:FeatureDataGrid.Columns> <slData:DataGridTemplateColumn Header="Remove"> <slData:DataGridTemplateColumn.CellTemplate> <DataTemplate> <HyperlinkButton Click="RemoveSelected_Click"> <HyperlinkButton.Background> <ImageBrush ImageSource="remove.png" /> </HyperlinkButton.Background> </HyperlinkButton> </DataTemplate> </slData:DataGridTemplateColumn.CellTemplate> </slData:DataGridTemplateColumn> </esri:FeatureDataGrid.Columns> </esri:FeatureDataGrid> [/HTML] Private Sub RemoveSelected_Click(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Dim test As List(Of Graphic) = MyDataGrid.SelectedGraphics For Each g As Graphic In test myGraphicsLayer.Graphics.Remove(g) Next g End Sub
... View more
08-31-2012
09:04 AM
|
0
|
0
|
655
|
|
POST
|
I have an application that uses the 10.1 PrintTask service. It also uses an offshoot of the persistent measurements found here. When I try to print those measurements, I get an error that says "Mixed geometry types are not supported." on Parameter name: Graphic. Is there any way to get round this issue? Do I need separate GraphicsLayers for the points, lines, polygons, and text graphics created by the measurement tool?
... View more
08-31-2012
08:49 AM
|
0
|
1
|
1009
|
|
POST
|
Is there a way to add extra columns to FeatureDataGrid while AutoGenerateColumns=True? For example, I want to add a column at the beginning of the featuredatagrid with a closing image that lets the user remove the graphic from the map when the image is clicked.
... View more
08-27-2012
07:27 AM
|
0
|
2
|
1040
|
|
POST
|
I tried that one, and it still gave me the same error. After searching around, I eventually found out how to set up the event handler in vb.
Dim featureLayer As FeatureLayer = New FeatureLayer() With {.ID = "DataLayer"}
' skip other setup code
AddHandler featureLayer.UpdateCompleted, AddressOf FeatureLayer_UpdateCompleted
' a little later...
Private Sub FeatureLayer_UpdateCompleted(ByVal sender As Object, ByVal e As EventArgs)
Dim myExtent As ESRI.ArcGIS.Client.Geometry.Envelope = CType(sender, FeatureLayer).FullExtent
If myExtent IsNot Nothing Then
MyMap.ZoomTo(myExtent)
End If
End Sub
The full extent is empty, but at least it's firing now.
... View more
07-17-2012
12:35 PM
|
0
|
0
|
1483
|
|
POST
|
Here's my code in VB.NET
Dim featureLayer As FeatureLayer = New FeatureLayer() With {.ID = "DataLayer"}
featureLayer.UpdateCompleted = Sub(snd, evt) MyMap.ZoomTo(featureLayer.FullExtent)
Here's the error that's returned: 'Public Event UpdateCompleted(sender As Object, e As System.EventArgs)' is an event, and cannot be called directly. Use a 'RaiseEvent' statement to raise an event.
... View more
07-17-2012
08:32 AM
|
0
|
0
|
1483
|
|
POST
|
When I try this code, I get this error: 'Public Event UpdateCompleted(sender As Object, e As System.EventArgs)' is an event, and cannot be called directly. Use a 'RaiseEvent' statement to raise an event. Basically, I can't programmatically add an UpdateCompleted event to a new Feature Layer.
... View more
07-16-2012
08:30 AM
|
0
|
0
|
1483
|
|
POST
|
Here's a few things. 1. Change your infoTemplate content to something like this:
infoTemplate.setContent( "<b>ROAD NAME: </b>${ROADNAME}<br/>"
+ "<b>CAT</b>${CAT}<br/>" // changed last tag to a line break
+ "<b>LINK_ID</b>${LINK_ID}"); // removed last tag because it was broken
2. in the init function, the highlightSymbol won't render because of the STYLE_CROSS should go with the fillSymbol and not the lineSymbol.
var highlightSymbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_CROSS, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255,0,0]), 3), new dojo.Color([125,125,125,0.35]));
3. When you use a FeatureLayer with snapshot mode and the outFields set to ["*"], you're literally downloading your entire dataset to the browser before it renders. with 50k features, that might take a while. Granted, function init never adds it to the map, so that may be one reason why it doesn't show. If you use the FeatureLayer capability to show the results, here is how I would set it up. This way, you don't have to use the second function at all.
// set maxAllowableOffset to generalize featureLayer for faster rendering.
var maxOffset = function (map, pixelTolerance) {
return Math.floor(map.extent.getWidth() / map.width) * pixelTolerance;
};
var featureLayer = new esri.layers.FeatureLayer("http://karthikpc:8399/arcgis/rest/services/Carriage_Mercantor/FeatureServer/0", {
mode: esri.layers.FeatureLayer.MODE_ONDEMAND,
infoTemplate: infoTemplate,
outFields: ["LINK_ID","ROADNAME","CAT"],
maxAllowableOffset: maxOffset(map, 1)
});
featureLayer.setDefinitionExpression("CAT = 'CATA'"); // from the where clause in your query
var highlightSymbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_CROSS, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255,0,0]), 3), new dojo.Color([125,125,125,0.35]));
featureLayer.setRenderer(highlightSymbol);
// after loading the base layers
map.addLayer(featureLayer);
... View more
05-09-2012
07:15 PM
|
0
|
0
|
733
|
|
POST
|
There's no orientation in map.infoWindow that I can find. The closest thing I can find so far is a CSS3 transform which might work (if you're supporting a newer browser like firefox, chrome, or IE9). For the following to your css.
.rotated270
{
transform:rotate(270deg);
-ms-transform:rotate(270deg); /* IE 9 */
-moz-transform:rotate(270deg); /* Firefox */
-webkit-transform:rotate(270deg); /* Safari and Chrome */
-o-transform:rotate(270deg); /* Opera */
}
Then, in your JavaScript, try this.
map.infoWindow.setTitle("Identify Results");
//map.infoWindow.setContent(tc.domNode);
if( (theLayerName != "Underground") && (idResults.length < 5) )
{
// alert("less than 5 records");
map.infoWindow.resize(360, 200);
dojo.query(".infowindow").removeClass("rotated270");
map.infoWindow.setContent(tc.domNode);
}
else if ( (theLayerName != "Underground") && (idResults.length >= 5) )
{
// alert(">= 5 records");
map.infoWindow.resize(900, 425);
dojo.query(".infowindow").addClass("rotated270");
map.infoWindow.setContent(tc.domNode);
// tc = tcLarge;
}
... View more
03-23-2012
10:22 AM
|
0
|
0
|
811
|
|
POST
|
Thanks Raymond, I tried this in this form but it did not work: var chkBoxes=dojo.query('input:checked','indFormM'); dojo.forEach(chkBoxes, function(check, i){ alert("ID = " + chkBoxes.id); }); Is there something wrong in this statement? Thanks, appreciate your help Samir I overlooked something earlier. Dojo.query uses CSS selectors, so to get all the checked inputs from form with id='indFormM', search for "#indFormM input:checked".
var chkBoxes=dojo.query('#indFormM input:checked'); // <- need to use CSS decendent selector
dojo.forEach(chkBoxes, function(chkBx){
alert("ID = " + chkBx.id);
});
... View more
03-23-2012
09:50 AM
|
0
|
0
|
2050
|
|
POST
|
Do you want to turn your infoWindow results sideways? Or do you want your infoWindow to be wider when there are more results? There is no "orientation" parameter for map.infoWindow. But for resize, the first number is width, and the second number is height. I would try flipping the numbers with resize to get the landscape/portrait effect. Here's some of your code modified.
map.infoWindow.setTitle("Identify Results");
//map.infoWindow.setContent(tc.domNode);
if( (theLayerName != "Underground") && (idResults.length < 5) )
{
// alert("less than 5 records");
map.infoWindow.resize(200, 360); // narrower for less records
map.infoWindow.setContent(tc.domNode);
}
else if ( (theLayerName != "Underground") && (idResults.length >= 5) )
{
// alert(">= 5 records");
map.infoWindow.resize(360, 200); // wider for more records
// map.infoWindow.orientation == 270; <- use = instead of == to set variable. This was causing your error.
map.infoWindow.setContent(tc.domNode);
// tc = tcLarge;
}
... View more
03-23-2012
06:58 AM
|
0
|
0
|
811
|
|
POST
|
Quick question: Are the other lines on top of the selected line in the same FeatureLayer?
... View more
03-23-2012
05:21 AM
|
0
|
0
|
1138
|
|
POST
|
Thanks Raymond, I tried this in this form but it did not work: var chkBoxes=dojo.query('input:checked','indFormM'); dojo.forEach(chkBoxes, function(check, i){ alert("ID = " + chkBoxes.id); }); Is there something wrong in this statement? Thanks, appreciate your help Samir dojo.forEach(chkBoxes, function(chkBx) { alert("ID = " + chkBx.id); });
... View more
03-22-2012
10:27 AM
|
0
|
0
|
2050
|
|
POST
|
the JavaScript API provides methods to move the layers on the map. Here's an example, just replace the urls with something that works. dojo.require("esri.map"); dojo.require("esri.layers.wms"); var map = new esri.Map("mapdiv"); // to initially set the layer order, create an array of layers var layerList = dojo.map(["base", "dog", "cat", "bird", "car"], function (urlEnding) { return new esri.layers.WMSLayer("http://wms-source/layer/" + urlEnding); }); map.addLayers(layerList); // map layer order: // ["base", "dog", "cat", "bird", "car"] // now if you want to move a layer around, use map.reorderLayer var movingLayer = new esri.layers.WMSLayer("http://wms-source/layer/toMove"); map.addLayer(movingLayer); // map layer order: // ["base", "dog", "cat", "bird", "car", movingLayer] map.reorderLayer(movingLayer, 2); // second number is index of map layer where you want to move the layer. // index of 0 is base layer (bottom layer) // map layer order: // ["base", "dog", movingLayer, "cat", "bird", "car"] http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/map.htm#reorderLayer
... View more
03-22-2012
10:21 AM
|
0
|
0
|
832
|
|
POST
|
Here's a little example:
var formElements = dojo.query("input:checked");
console.log("First radio input id: ", formElements[0].id);
console.log("Second radio input name: ", formElements[1].name);
console.log("Third radio input value: ", formElements[2].value);
For more information: http://livedocs.dojotoolkit.org/dojo/query
... View more
03-22-2012
09:48 AM
|
0
|
0
|
2050
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 08-05-2013 11:45 AM | |
| 1 | 05-20-2015 08:05 AM | |
| 2 | 03-24-2017 07:11 AM | |
| 2 | 03-28-2018 07:45 PM | |
| 1 | 07-03-2018 07:29 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:23 AM
|