|
POST
|
You could have a globally declared array and every time the queryFeatures function runs, just push the features it returns into the array. Something like.. var allFeatures = {};
layers[layerId].LayerVariable.queryFeatures(query, function (featureSet) {
dojo.forEach(featureSet.features, function(feature) {
allFeatures.push(feature);
});
.
.
.
} Steve
... View more
04-23-2014
11:28 AM
|
0
|
0
|
1168
|
|
POST
|
One of my converted VBA tools allows the user to quickly create a custom color ramp for elevation data and bypass the annoyingly long statistics building step when you do the same thing through the layer's property dialog. In my tool, a simple dialog appears in which you select the raster, enter a starting elevation, the number of classes to render, and finally the interval of each class. I use this tool to explore the subtle features found in LIDAR data. Anyways, VBA and dot.net versions of my code USED to work fine whether the data was coming from SDE or a file based raster format (IMG, TIFF, etc). Now the code only works for rasters coming from SDE and I can't seem to understand why this is. Can anyone see what I'm missing in my attached code? This is the code that runs once the user clicks OK: Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click
Me.DialogResult = System.Windows.Forms.DialogResult.OK
Dim I As Integer
Dim minElev As Long
Dim numClasses As Integer
Dim theInterval As Double
Dim theRaster As String
Dim curElev As Double
Dim application As ESRI.ArcGIS.Framework.IApplication
Dim pMxDoc As ESRI.ArcGIS.ArcMapUI.IMxDocument
Dim pMap As ESRI.ArcGIS.Carto.IMap
Dim pID As New ESRI.ArcGIS.esriSystem.UID
Dim pEnumLayer As ESRI.ArcGIS.Carto.IEnumLayer
Dim pLayer As ESRI.ArcGIS.Carto.ILayer
Dim pRLayer As ESRI.ArcGIS.Carto.IRasterLayer
Dim pRaster As ESRI.ArcGIS.Geodatabase.IRaster
Dim PMouseCursor As ESRI.ArcGIS.Framework.IMouseCursor
PMouseCursor = New ESRI.ArcGIS.Framework.MouseCursor
PMouseCursor.SetCursor(0)
Try
Application = My.ArcMap.Application
Dim document As ESRI.ArcGIS.Framework.IDocument = Application.Document
pMxDoc = application.Document
pMap = pMxDoc.FocusMap
pID.Value = "{6CA416B1-E160-11D2-9F4E-00C04F6BC78E}"
If String.IsNullOrEmpty(Me.txtStartElev.Text) Or Me.txtStartElev.Text = "" Then
MsgBox("You did not specify a starting elevation.", MsgBoxStyle.Exclamation, "Error")
Exit Sub
End If
If String.IsNullOrEmpty(Me.txtNumLevels.Text) Or Me.txtNumLevels.Text = "" Then
MsgBox("You did not specify the number of classes.", MsgBoxStyle.Exclamation, "Error")
Exit Sub
End If
If String.IsNullOrEmpty(Me.cboInterval.Text) Or Me.cboInterval.Text = "" Then
MsgBox("You did not specify the interval.", MsgBoxStyle.Exclamation, "Error")
Exit Sub
End If
minElev = CInt(Me.txtStartElev.Text)
numClasses = CInt(Me.txtNumLevels.Text)
theInterval = CDbl(Me.cboInterval.Text)
theRaster = Me.cboRasterLyr.Text
curElev = minElev
pEnumLayer = pMap.Layers(pID, True)
pEnumLayer.Reset()
pRLayer = Nothing
pLayer = pEnumLayer.Next
Do While Not pLayer Is Nothing
If TypeOf pLayer Is ESRI.ArcGIS.Carto.IRasterLayer Then
If StrComp(pLayer.Name, theRaster, vbTextCompare) = 0 Then
pRLayer = pLayer
End If
End If
pLayer = pEnumLayer.Next
Loop
If TypeOf pRLayer.Renderer Is ESRI.ArcGIS.Carto.IRasterStretchColorRampRenderer Then
Dim question, answer
question = "It may take a long time in order to change this raster's" & vbNewLine
question = question & "symbology. Are you sure you would like to continue?" & vbNewLine
answer = MsgBox(question, MsgBoxStyle.YesNo, "WARNING!")
If answer = vbNo Then
Exit Sub
End If
End If
'Create classfy renderer and QI RasterRenderer interface
pRaster = pRLayer.Raster
Dim pClassRen As ESRI.ArcGIS.Carto.IRasterClassifyColorRampRenderer
pClassRen = New ESRI.ArcGIS.Carto.RasterClassifyColorRampRenderer
Dim pRasRen As ESRI.ArcGIS.Carto.IRasterRenderer
pRasRen = pClassRen
'These simple three lines is all you need in order to change the color ramp
'that is used. They do need to exist shortly after pClassRen is initialized
'otherwise the specification is ignored..
Dim pClassProp As ESRI.ArcGIS.Carto.IRasterClassifyUIProperties
pClassProp = pClassRen
pClassProp.ColorRamp = "Temperature" 'Name of Ramp from Style Manager
'Set raster for the render and update
pRasRen.Raster = pRaster
pClassRen.ClassCount = numClasses
pRasRen.ResamplingType = ESRI.ArcGIS.Geodatabase.rstResamplingTypes.RSP_BilinearInterpolation 'Set to Bilinear Interpretation
pRasRen.Update() 'THIS IS WHERE THE CODE CRASHES
'loop through the classes and update the label
For I = 0 To pClassRen.ClassCount - 1
pClassRen.Break(I) = curElev
Select Case I
Case 0
pClassRen.Label(I) = "< " & CStr(curElev) & " Feet"
Case pClassRen.ClassCount - 1
pClassRen.Label(I) = "> " & CStr(curElev) & " Feet"
Case Else
pClassRen.Label(I) = CStr(curElev) & " - " & CStr(curElev + theInterval)
End Select
curElev = curElev + theInterval
Next I
'Update the renderer and plug into layer
pRasRen.Update()
pRLayer.Renderer = pClassRen
pMxDoc.ActiveView.Refresh()
pMxDoc.UpdateContents()
'Release memeory
pMxDoc = Nothing
pMap = Nothing
pRLayer = Nothing
pRaster = Nothing
pRasRen = Nothing
pClassRen = Nothing
pClassProp = Nothing
Me.Close()
Catch ex As Exception
globalErrorHandler(ex)
End Try
End Sub The error handler returns the following when it crashes: ERROR DESCRIPTION: Error HRESULT E_FAIL has been returned from a call to a COM component. TYPE OF ERROR: System.Runtime.InteropServices.COMException STACK TRACE: at ESRI.ArcGIS.Carto.RasterClassifyColorRampRendererClass.Update() at pwTools2.frmAdjustColorramp.OK_Button_Click(Object sender, EventArgs e) in C:\Visual Studio 2008\Projects\pwTools2\pwTools2\frmAdjustColorramp.vb:line 105 Any ideas? THANKS! Steve
... View more
04-22-2014
02:30 PM
|
0
|
0
|
2276
|
|
POST
|
I would probably use a map event listener such as zoom-end to listen for when the user zooms in or out on the map. Within that event function, simply use map.getLevel() to get the current zoom level and compare that number against whatever zoom level threshold you want. If they've zoomed further out, disable the button otherwise enable the button. If you don't know what threshold you want to use, just manually zoom in & out on your map until you're at the last level you want to enable your button. Open up a javascript console and type: console.log map.getLevel() Now you know the zoom level to use as your threshold. Steve
... View more
04-18-2014
09:09 AM
|
0
|
0
|
1294
|
|
POST
|
One of the data layers shown on our web app is a feature layer that's created at page load based on data stored in a standalone table in SDE. Although our web app doesn't edit the table (it's stream gage data so it's just constantly refreshed), I included into the MXD for another feature class that is also shown on our web app. I don't feel that it's too kludgey but the app is somewhat basic and doesn't have a laundry list of datasets to display or edit. Steve
... View more
04-17-2014
01:41 PM
|
0
|
0
|
812
|
|
POST
|
ESRI's own guidance now is that you should move to HTML5 & the Javascript API. Microsoft hasn't said anything about Silverlight's future with the exception that it will support it as a product until 2021 or so.
... View more
03-13-2014
07:36 AM
|
0
|
0
|
634
|
|
POST
|
I was all set to respond with "I don't know" but just had another idea. You probably can't modify the actual log in process into your ArcGIS Online account so maybe you can intercept it just before then by creating an event listener for the text box that the user actually enters their login name. The event I'd consider playing with is the onChange event. In that situation, simply convert the current login entered into lower case. When the user clicks the log in button, it will then read the all lower case login. You probably need to be careful since there's the possibility of an endless loop (first onChange function triggers another then another). Maybe evaluate if the login entered is already in all lower case?..
... View more
03-11-2014
09:28 AM
|
0
|
0
|
1989
|
|
POST
|
Hmm, yeah. I don't have access to a working example of this template but I suspect that my code suggestion is taking place AFTER the user actually tries to sign in. Is there some other function that calls AuthenticateUser, because this seems like the event function once someone actually clicks a log in button.
... View more
03-11-2014
07:48 AM
|
0
|
0
|
1989
|
|
POST
|
I'd highly doubt you can change that since it's an OS thing. Why not just convert the user login to lower case using JS? portalUser = loggedInUser.toLowerCase(); Steve
... View more
03-11-2014
07:06 AM
|
0
|
0
|
1989
|
|
POST
|
I've made a mobile centric version of my application using Jquery Mobile as my UI (direct link here) and I'm having an annoying issue with the map's Div. The app has three pages and each page does have a header that is fixed in terms of its positioning. The map page has a footer and it also has fixed positioning. The problem is that, at least on my iPhone, the map div's content can scroll underneath the header of the page making the zoom buttons inaccessible. How do I prevent this from happening? Mobile being mobile, I know that I need to adapt to screen sizes and orientations. During the intial page load, I evaluate the user's screen to adjust the map page's header,footer, and content height: $(document).ready(function() {
headerHeight = $('#mapHeader').height();
footerHeight = $('#mapFooter').height() + 5;
mapHeight = $(window).height() - headerHeight - footerHeight;
$('#map').height(mapHeight);
map.resize();
}); I have the same basic code to account for orientation changes: $( window ).on( "orientationchange", function( event ) {
headerHeight = $('#mapHeader').height();
footerHeight = $('#mapFooter').height() + 5;
console.info('Header Height: ' + headerHeight);
console.info('Footer Height: ' + footerHeight);
mapHeight = $(window).height() - headerHeight - footerHeight;
$('#map').height(mapHeight);
if ($.mobile.activePage.attr('id') == "mapPage") {
map.resize();
}
}); I also read about touchmove in my web searches so I threw this in my code for good measure: $('#mapPage').delegate('.ui-content', 'touchmove', false);
Didn't seem to make any difference. Anyone have any tips? Thanks! Steve
... View more
03-07-2014
07:15 AM
|
0
|
0
|
996
|
|
POST
|
One option might be to store your bookmark information in a standalone table that's tucked inside one of your published services and then just use a queryTask on the table to retrieve the needed information (e.g. "NAME='Times Square'"). Steve
... View more
03-07-2014
06:51 AM
|
0
|
0
|
774
|
|
POST
|
The reason for the change seems quite clear to me- the free ride is over. Just like what happened with routing at the end of last year, ESRI wants to now lock you into paying for these services using ArcGIS Online accounts & credits. ESRI still provides two elevation globeserver REST endpoints but probably not at the resolution you want: http://services.arcgisonline.com/arcgis/rest/services/Elevation Looks like you'll either have to a.) pay for credits & use ESRI's previously free service, b.) load up and serve your own elevation data, or c.) hope that the USGS or other fed agency is already serving up elevation data as a REST service someplace.
... View more
02-25-2014
02:11 PM
|
0
|
0
|
4411
|
|
POST
|
You could try other tools for formatting your dates. DateJS is a good library to have and use. One thing I've learned is that date formatting is NOT consistent across different browsers and DateJS does a pretty good job of doing this. Another option you can try is simply this: function formatTimestamp(value) {
var inputDate = new Date(value);
return inputDate.toString();
} The text returned will be "Fri Feb 14 09:48:30 PST 2014" Steve
... View more
02-14-2014
07:51 AM
|
0
|
0
|
2095
|
|
POST
|
When I've used a formatter with my dGrids, I have it call a standalone function instead of doing the formatting work inline. Your modified code would be something like this: window.grid = new (declare([Grid, Selection])) ({ bufferRows:Infinity, columns: { "id": "ID", "vehicleId": "Vehicle ID", "velocity": {"label": "Speed (MPH)", "formatter":dojoNum.format}, "timestamp": {"label": "Time Stamp", "formatter":formatTimestamp} } }, "grid"); . . . . function formatTimestamp(value) { var inputDate = new Date(value); return dojo.date.locale.format(inputDate, { selector: 'date', datePattern: 'MM/dd/yyyy' }); }
... View more
02-14-2014
06:16 AM
|
0
|
0
|
2095
|
|
POST
|
Maybe compare the extents before actually changing the extent? If they are the same, end the function.
... View more
02-13-2014
02:17 PM
|
0
|
0
|
1711
|
|
POST
|
Am I missing the point of your issue? Here's a slightly modified snippit of ESRI sample code that I use to load my basemapGallery widget with the ESRI basemaps with the exception of the Oceans basemap: // Populate the basemap gallery widget with the list of ESRI basemaps
dojo.connect(basemapGallery, 'onLoad', function () {
//add the basemaps to the menu but exclude the "Oceans" basemap
dojo.forEach(basemapGallery.basemaps, function (basemap) {
if (basemap.title != 'Oceans') {
dijit.byId("basemapMenu").addChild(new dijit.MenuItem({
label: basemap.title,
onClick: dojo.hitch(this, function () {this.basemapGallery.select(basemap.id);})
}));
}
});
}); It's in legacy code. Sorry. Steve
... View more
02-03-2014
06:06 AM
|
0
|
0
|
2069
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 3 weeks ago | |
| 2 | 3 weeks ago | |
| 2 | 05-21-2026 01:51 PM | |
| 1 | 03-12-2026 01:43 PM | |
| 1 | 03-12-2026 08:41 AM |