POST
|
This is what I used to get this working from the examples above. After modifying the fieldInfo for the previously created memorynet feature layer, I created another feature layer from that and then used the "in_memory//" to create yet another layer which had the correctly modified fields. keepFieldList = ("Field1","Field2", "Field3", "Field4", "Field5")
fieldInfo = ""
fieldList = gp.listfields(memorynet)
for field in fieldList:
if field.name in keepFieldList:
print field.name
fieldInfo = fieldInfo + field.Name + " " + field.name + " VISIBLE;"
else:
fieldInfo = fieldInfo + field.Name + " " + field.Name + " HIDDEN;"
print fieldInfo
gp.MakeFeatureLayer_management(memorynet, "feature_layer", "", "", fieldInfo[:-1])
memfldNet = "in_memory//memfldNet"
arcpy.CopyFeatures_management("feature_layer", memfldNet)
... View more
08-19-2016
12:42 PM
|
0
|
0
|
1598
|
POST
|
Thanks Duncan once again. You are correct that the important text I'm trying to use will always be 11 characters in this format: XX0000-0000 . I've thought about trying to use the hyphen in the middle as an identifier w/ 6 characters to the left and 4 to the right and do some magical text parsing or splitting or whatever. I've never done any type of text manipulation so this will be new stuff. Do I have to make a new public sub for the text manipulation or can I put it under the Public Sub CommandButton1 stuff? There is really no way of me knowing what will be included with this text when a user pastes it in. Sometimes we copy stuff from an email, sometimes a word document, but most times it comes from an Access or Excel spreadsheet. That's why I the spreadsheet previously worked so well because each row essentially had a single quote and comma. You could type in: howdy Supper Time XX0000-0000 XX0000-0001 And it would put Howdy in like: [StID] IN ('Howdy', 'Supper Time', 'XX0000-0000', etc) and since it just wouldn't find the first to strings in the field, it wouldn't care and just move on. Furthermore, with the textbox I'm using now, I can't type in more than one line. It is a multiline textbox, but only if I paste more than one line. If I hit enter, it fires the button, and doesn't drop down to the next line/row which I would like it to. So there are several limitations I'm seeing with the textbox. And also there is no row count, so you can't see how many StID's have been pasted in there. But that is pretty unimportant in the scheme of things. I do thank you for you help and I'll keep working on this.
... View more
01-30-2014
08:48 AM
|
0
|
0
|
319
|
POST
|
Thanks for the time and attention Duncan. The code I pasted in here is slightly modified in that I changed all the StID to "ID" for whatever reason, but they are correct in the code I'm running. I put a message box under the pQueryFilter.WhereClause to see what the string looked like when I would paste in text. Apparently it is NOT in the format I need as it doesn't have a single quote and comma similar to the 'Select By Attributes' standard method. I'm not sure if I can somehow write in code to format the input in such a way or not. The previous tool used a textbox but had rows and a column embedded within it which was set using the 'Properties' tab of the texbox so it mimicked a spreadsheet. This is no longer an option and is why I'm just using a textbox. The problem I've seen is when I paste in a string like this (below) StID WC0000-0000 WC0000-0001 XX0022-0022 The textbox is reading it as [StID] IN (StIDWC0000-0000WC0000-0001XX0022-0022) I think. It needs to ignore the first pasted in StID (or put in its own 'StID', which will ignore it) and It needs to be [StID] IN ('WC0000-0000','WC0001-0001','XX0022-0022') Is this a way I can systematically add in the single quotes and a comma to this string: pStID = "[StID] IN (" & "'" & txtStID.Text & "'" & ")" ???
... View more
01-29-2014
08:49 AM
|
0
|
0
|
319
|
POST
|
Hello all, I'm trying to migrate some VBA code written in 9.2 into a Win7, Office 2010, 10.2 format and I'm having a little trouble as I'm very novice at programing. My tool is pretty basic that I'm trying to create. It uses a form with a textbox to which someone would paste in text in to be used as a selection. Its basically just a select by attributes with a custom form since all the selections are on the same field in the same layer. Layer = Forest Field = ID Format is always XX0000-0000. My tool runs through the code successfully but stops at the pFeatureSelection.SelectFeatures at the bottom below the pActiveView and does not make a selection. I can't figure out what is going on. I've tried pasting in what seems like updated code format but it does not like this barks at me. If anyone has suggestions it would be very appreciated. Public Sub CommandButton1_Click()
Dim pStID As String
Dim pMxDoc As IMxDocument
Dim pMap As IMap
Dim pActiveView As IActiveView
Dim pFeatureLayer As IFeatureLayer
Dim pFeatureSelection As IFeatureSelection
Dim pQueryFilter As IQueryFilter
Dim pEnumLayer As IEnumLayer
Set pMxDoc = Application.Document
Set pMap = pMxDoc.FocusMap
Set pActiveView = pMap
Set pEnumLayer = pMxDoc.FocusMap.Layers
Set pFeatureLayer = pEnumLayer.Next
Do Until pFeatureLayer Is Nothing
If pFeatureLayer.Name = "Forest" Then
Exit Do
End If
Set pFeatureLayer = pEnumLayer.Next
Loop
'txtID.pActiveSheet.Range("ID").Select
'txtID.Selection.Copy
'txtStID.Paste
'txtID.pActiveSheet.Range("E1").Select
'txtStID.Selection.Copy
'txtID.pActiveSheet.Range("B1").Activate
If pFeatureLayer Is Nothing Then
MsgBox "It Is Empty"
Exit Sub
End If
Set pFeatureSelection = pFeatureLayer
pID = "[ID] IN (" & txtID.Text & ")"
Set pQueryFilter = New QueryFilter
pQueryFilter.WhereClause = pID
pActiveView.PartialRefresh esriViewGeoSelection, Nothing, Nothing
'THE PFEATURESELECTION LINE BELOW DOES NOT WORK. I DON'T KNOW WHY!!
pFeatureSelection.SelectFeatures pQueryFilter, esriSelectionResultNew, False
pActiveView.PartialRefresh esriViewGeoSelection, Nothing, Nothing
'THIS CODE BELOW SEEMS TO BE AN UPDATED VERSION BUT DOES NOT WORK
''pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, Nothing, Nothing)
' Perform the selection using the user input.
'' pFeatureSelection.SelectFeatures(pQueryFilter, esriSelectionResultEnum.esriSelectionResultNew, False)
End Sub
... View more
01-28-2014
12:50 PM
|
0
|
4
|
768
|
POST
|
Hi, I'm exploring options for utilizing imagery, either as an Image Service, or pre-cached file loaded onto a Juno 3B. I'm wondering if anyone has successfully created a Imagery Service and consumed the data within a Mobile Device. If so, my real question is: is it possible to consume the imagery service while connected to an ArcGIS Server with internet connections, then "cache" the imagery service on the handheld, and operate off-line in the field with the temp "cache" still viewable? Currently, the workflow of creating small caches of tiles and loading them onto a device is extremely inefficient. Thanks in advance! Kevin
... View more
07-11-2013
07:14 AM
|
0
|
0
|
351
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|