POST
|
I asked Dr. Aileen Buckley, Esri Cartographer for her advice. She wrote a blog post that explains when you should use singular and plural for legend items. I asked, ”Is there a cartographic convention or guideline for legend item labels being singular or plural? Do plural labels imply something different if there are both singular and plural entries?” In summary; "As a rule, legend times labels should be singular nouns."... Also, ”Do plural labels imply something different?” Yes, they do. The most common interpretation of legend item labels that are plural is that there are multiple things of the same type in a single location." Entry on the ArcGIS Blog.abuckley-esristaff Legend item labels – singular or plural | ArcGIS Blog
... View more
08-29-2016
02:17 PM
|
2
|
0
|
1769
|
POST
|
I should not have included that ancestry.com example, that made it unclear. I'm not actually concerned about legend categories, just entries. I also forgot to include this screenshot of two different legends. Is this completely a matter of opinion or are there some guidelines? Is Road better than Roads? Does Road imply only one road is on the map? I My intended audience is engineers and geoscientists. The maps I'm making are for formal signed reports.
... View more
08-25-2016
08:55 AM
|
0
|
1
|
1769
|
POST
|
In a map legend should the entries be singular or plural? It seems like they should be singular. i.e. Road instead of Roads. In my experience I have seen it both ways even on the same legend. A Google image search for "map legend" lead me to conclude there is no consistent way of having a legend entry be singular or plural. The more authoritative maps I've seen have legend entries in singular. (USGS, National Geographic, etc) So my question is, in what cases is a plural legend entry correct? This guide says singular: http://gisgeography.com/map-elements-how-to-guide-map-making/ entry 32: Features in Legend are Present and Singular This legend has legend categories in plural, but the individual entries are singular http://www.rootsweb.ancestry.com/~alfayett/Map_Legend.html
... View more
08-24-2016
02:14 PM
|
0
|
5
|
3005
|
POST
|
Thanks Duncan. I forgot to add contextHelpItem.Refresh After that my changed caption became visible. I find it strange that you're allowed to change the Caption but not the ToolTip, but oh well. I also found out how to change the icon for a different button on the toolbar. I have a button that toggles between a locked/unlocked state. For it work I had to have two bitmap images added as 'Embedded Resource', plus the initial image for the toolbar added separately (different filename) as an AddInContent rfairhur24: Thanks for your suggestion. I will look into that further, but for now I'll leave the functionality the same. Usually it is done to change the borders of the map to Spanish text even though the ArcMap user is an English speaker. Some of our clients want their map borders in Spanish.
... View more
07-02-2013
09:11 AM
|
0
|
0
|
608
|
POST
|
I'm trying to change the icon, caption and tooltip of an button in my custom toolbar. I'm using the add-in process inside Visual Studio. Ideally I don't want an icon, just the text "English" or "Spanish" to appear on the toolbar depending on what the user clicks. If I can't have the text then an icon that can alternate between 2 different choices would be ok. If I try to change the FaceID, ToolTip or Caption ArcMap crashes. I can get the contextHelpItem.Name property so I know I'm getting the correct button and toolbar. ArcGIS 10.1, Visual Studio 2010, VB.net Dim documentBars As ICommandBars = m_Application.Document.CommandBars Dim barID As UID = New UIDClass barID.Value = "BGC_Engineering_Inc_BGCLayout_Tool_v4_BGC_Layout_Tool" '"{ebecdd6c-d4da-4523-b478-aab7f940b87e}" Dim barItem As ICommandItem = documentBars.Find(barID, False, False) If Not (barItem Is Nothing) Then ' AndAlso barItem.Type = ESRI.ArcGIS.Framework.esriCommandTypes.esriCmdTypeToolbar Then Dim commandBar As ICommandBar = CType(barItem, ICommandBar) Dim commandID As ESRI.ArcGIS.esriSystem.UID = New ESRI.ArcGIS.esriSystem.UIDClass commandID.Value = "BGC_Engineering_Inc_BGCLayout_Tool_version_4_btn_Language" Dim contextHelpItem As ICommandItem = commandBar.Find(commandID, False) If Not contextHelpItem Is Nothing Then ' get bitmap 'Dim newIcon As System.Drawing.Bitmap If g_bEnglish = True Then 'newIcon = New System.Drawing.Bitmap(Me.GetType(), "Images/btn_Language_en.bmp") 'contextHelpItem.FaceID = ESRI.ArcGIS.ADF.COMSupport.OLE.GetIPictureDispFromBitmap(newIcon) 'contextHelpItem.Style = esriCommandStyles.esriCommandStyleTextOnly 'contextHelpItem.Caption = "English" contextHelpItem.Tooltip = "Now English" Else 'newIcon = New System.Drawing.Bitmap(Me.GetType(), "Images/btn_Language_es.bmp") 'contextHelpItem.FaceID = ESRI.ArcGIS.ADF.COMSupport.OLE.GetIPictureDispFromBitmap(newIcon) 'contextHelpItem.Style = esriCommandStyles.esriCommandStyleTextOnly 'contextHelpItem.Caption = "Spanish" contextHelpItem.Tooltip = "Now Spanish" End If End If End If
... View more
06-26-2013
01:31 PM
|
0
|
3
|
3210
|
POST
|
Thanks John. I will try using that settings. In the meantime I created this convoluted workaround where I create a whole bunch of text files, they all have headers, read the second line and then append that to a new file. Quite a pain but it worked. When I get the chance I'll re-code it to make it simpler. 😄
... View more
01-18-2011
12:09 PM
|
0
|
0
|
204
|
POST
|
I got around this problem by setting the new cut geometry back to the original polygon so that I didn't have to do any deleting of records. I'm not sure why deleting of records is such a problem. Hopefully Arc10 will be better.
... View more
01-17-2011
07:35 AM
|
0
|
0
|
207
|
POST
|
I am running the geoprocessing tool SurfaceVolume (in 3D analyst toolbar) from Visual Studio 2010. ' Create the Geoprocessor object
Dim Result As ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult
Dim geoProcTool As SurfaceVolume = New SurfaceVolume
geoProcTool.in_surface = strDEM
geoProcTool.out_text_file = strOutputFile
geoProcTool.reference_plane = strReferencePlane
geoProcTool.base_z = dblPlaneHeight
geoProcTool.z_factor = dblZfactor
' Start from top elevation, go down by interval to lower plane
Do While dblPlaneHeight > dblLowerPlane
' run process: Surface Volume...
Result = RunTool(geoProcTool, Nothing)
' Increment plane height by interval
dblPlaneHeight -= dblInterval
intRows += 1
Loop
This was working with 9.3.1, but when I upgraded to 10 after the first time through the loop it complained that strOutputFile already exists and won't append to the file like it is supposed to. I thought maybe that the tool changed at 10, but it doesn't seem to have any extra parameters. Is there a way to turn an overwrite setting on somewhere? I'm running ArcGIS 10 on MS Windows Server 2008 R2.
... View more
01-17-2011
07:32 AM
|
0
|
2
|
544
|
POST
|
Hi I'm trying to cut a shapefile that has one polygon in it, with a line from another shapefile. The actual cutting of the polygon and creating of two new polygons seems to work fine, but then I want to delete the original polygon so there should be only 2 polygons, but the original is still there. The attribute table shows 3 but only 2 are showing when it draws. See the bold section in the code below. Am I missing something? I also tried this code to delete the original polygon: Using comReleaser As ComReleaser = New ComReleaser
Dim newFeatCurs As IFeatureCursor = polyFtrClass.Search(qryFilter, False) '.Update(qryFilter, False)
comReleaser.ManageLifetime(newFeatCurs)
Dim delFeature As IFeature = newFeatCurs.NextFeature
Do While Not delFeature Is Nothing
delFeature.Delete()
delFeature = newFeatCurs.NextFeature
Loop
newFeatCurs = Nothing
End Using I'm using ArcMap 9.3.1 SP2, and programming in VB.NET (Visual Studio 2005.)
Public Sub cutty(ByVal app As IApplication)
Debug.Print("cutty")
' Add layers to map
Dim mxDoc As IMxDocument = app.Document
Dim map As IMap = mxDoc.FocusMap
Dim lyr As ILayer
Dim strInputLayer As String = "test_polygon"
Dim strCopy As String = "test_manipulate"
Dim ftrlyr As IFeatureLayer = New FeatureLayer
Dim featClass As IFeatureClass
Dim ds As IDataset = Nothing
' delete output layer from map if it's there
' get input layer from TOC
Dim i As Integer
For i = map.LayerCount - 1 To 0 Step -1
lyr = map.Layer(i)
If UCase(lyr.Name) = UCase(strCopy) Then
map.DeleteLayer(lyr)
ElseIf UCase(lyr.Name) = UCase(strInputLayer) Then
ftrlyr = lyr
featClass = ftrlyr.FeatureClass
ds = featClass
End If
Next i
Dim wkspcFactory As IWorkspaceFactory = New ShapefileWorkspaceFactory()
Dim inWorkspace As IWorkspace = ds.Workspace
Dim featWorkspace As IFeatureWorkspace = inWorkspace
Dim ftrlyrCopy As IFeatureLayer = New FeatureLayer
If ds.CanCopy Then
Try
Dim featClass2 As IFeatureClass = featWorkspace.OpenFeatureClass(strCopy)
Debug.Print("trying to open: " & strCopy)
Dim ds2 As IDataset = featClass2
ds2.Delete()
Debug.Print("Deleted: " & strCopy)
Catch ex As Exception
Debug.Print("FAILED TO DELETE")
End Try
ds.Copy(strCopy, inWorkspace)
ftrlyrCopy.FeatureClass = featWorkspace.OpenFeatureClass(strCopy)
ftrlyrCopy.Name = strCopy
mxDoc.AddLayer(ftrlyrCopy)
End If
mxDoc.UpdateContents()
mxDoc.ActiveView.Refresh()
Debug.Print("DONE")
' CUT PART
Try
' Setup
Debug.Print("* cutty ************************************")
' HARDCODED -----------------------------------
Dim strCutline As String = "test_cutline"
Dim strfootprint As String = strCopy
Dim crestFtrLyr As IFeatureLayer = New FeatureLayer
Dim crestFtrClass As IFeatureClass = featWorkspace.OpenFeatureClass(strCutline)
'----------------------------------------------
' Get dam crest layer i.e. cutting line
' COMMENTED OUT FOR TESTING
'Dim crestFtrLyr As IFeatureLayer = GetLayerByName(strCutline)
'Dim crestFtrClass As IFeatureClass = crestFtrLyr.FeatureClass
' Select the right side dam crest (positive direction)
Debug.Print(" Select right side dam crest")
Dim qryFilter As IQueryFilter = New QueryFilter()
qryFilter.WhereClause = "Comment = 'crestedge-pos'"
Dim crestFeatCurs As IFeatureCursor = crestFtrClass.Update(qryFilter, False)
Dim crestFeature As IFeature = crestFeatCurs.NextFeature()
Dim pCutLineLeft As IPolyline
Dim pCutLineRight As IPolyline
pCutLineRight = crestFeature.Shape
' Now the left crest (negative direction)
Debug.Print(" Select left side dam crest")
qryFilter.WhereClause = "Comment = 'crestedge-neg'"
crestFeatCurs = crestFtrClass.Update(qryFilter, False)
crestFeature = crestFeatCurs.NextFeature()
pCutLineLeft = crestFeature.Shape
crestFeature = Nothing
crestFeatCurs = Nothing
' Get polygon footprint
Debug.Print(" poly footprint")
Dim polyFtrLyr As IFeatureLayer = GetLayerByName(strfootprint)
Dim polyFtrClass As IFeatureClass = polyFtrLyr.FeatureClass
'================================================================
' Use dam crest to cut footprint poly into 3 features
' First cut the polygon into 2 pieces with the right cutting line
Debug.Print(" Part 1 Now make new right")
Dim pSF As ISpatialFilter = New SpatialFilter()
pSF.Geometry = pCutLineRight
pSF.GeometryField = "Shape"
pSF.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects
Dim polyFeatCurs As IFeatureCursor
polyFeatCurs = CType(polyFtrClass.Update(pSF, False), IFeatureCursor)
Dim polyFeature As IFeature = polyFeatCurs.NextFeature()
Dim origPolygon As IPolygon = polyFeature.ShapeCopy 'Shape or ShapeCopy ?????
' note: ITopologicalOperator5 gives an error
Dim pTopoOper As ITopologicalOperator4 = Nothing
pTopoOper = origPolygon
Dim pLGeom As IPolygon = Nothing
Dim pRGeom As IPolygon = Nothing
pTopoOper.Cut(pCutLineRight, pLGeom, pRGeom)
' Make a new right poly
polyFeatCurs = polyFtrClass.Insert(True)
Dim polyFeatBuf As IFeatureBuffer
polyFeatBuf = polyFtrClass.CreateFeatureBuffer
polyFeatBuf.Shape = pRGeom
polyFeatBuf.Value(polyFeatBuf.Fields.FindField("Comment")) = "RIGHT"
Dim pArea As IArea = pRGeom
polyFeatBuf.Value(polyFeatBuf.Fields.FindField("Area")) = pArea.Area
polyFeatCurs.InsertFeature(polyFeatBuf)
'polyFeatCurs.Flush()
polyFeatCurs = Nothing
' Make a new left poly
polyFeatCurs = polyFtrClass.Insert(True)
polyFeatBuf = polyFtrClass.CreateFeatureBuffer
polyFeatBuf.Shape = pLGeom
polyFeatBuf.Value(polyFeatBuf.Fields.FindField("Comment")) = "LEFT"
pArea = pLGeom
polyFeatBuf.Value(polyFeatBuf.Fields.FindField("Area")) = pArea.Area
polyFeatCurs.InsertFeature(polyFeatBuf)
polyFeatCurs.Flush()
polyFeatCurs = Nothing
polyFeatBuf = Nothing
' delete original polygon
Debug.Print(" ----delete original----")
qryFilter.WhereClause = "Comment = 'FOOTPRINT'"
Dim table As ITable = CType(polyFtrClass, ITable)
table.DeleteSearchedRows(qryFilter)
table = Nothing
' There should be two records, but the original polygon is still there.
Debug.Print(" Number of records = " & polyFtrClass.FeatureCount(Nothing))
' Refresh view
mxDoc.ActiveView.Refresh()
MessageBox.Show("Finished")
Catch ex As Exception
Debug.Print("--EXCEPTION HAS OCCURRED IN cutty-")
Debug.Print(ex.Message)
MessageBox.Show("Error #" & Information.Err().Number & Environment.NewLine & Information.Err().Description & Environment.NewLine & Information.Err().Source, "cutty", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
... View more
01-07-2011
01:54 PM
|
0
|
1
|
653
|
POST
|
If (TypeOf (firstLayer) Is ESRI.ArcGIS.Carto.IFeatureLayer) Then So it looks like TypeOf will work after all. This is the same line I had in my code originally (minus the extra brackets). I guess I was confused by the UPGRADE WARNING: TypeOf has new behavior" message. This message appeared in my code after I ran the VB6 to VB.NET upgrade wizard in VS 2005. In the "Click for more" it says that TypeOf must be replaced with GetType. In Visual Basic 6.0, the TypeOf function is used in an If...Then...Else statement to determine whether an object reference is of a specified object type. In this context, a user-defined type is considered to be an object type. In Visual Basic 2005, user-defined types (now known as structures) are not object types and cannot be evaluated by the TypeOf function. It goes on to say that I should use a structure like this: ' Modified code
Dim m As MyType
Dim mTest As MyType
If m.GetType Is mTest.GetType Then ... To answer your question, I am setting firstLayer to a layer in the TOC using a loop. For i = 0 To map.LayerCount - 1
firstLayer = map.Layer(i) So firstLayer is not Null when I get to the GetType line. If firstLayer.GetType().ToString().Equals("ESRI.ArcGIS.Carto.IFeatureLayer") Then So in conclusion even though it says to use GetType, I can continue to use TypeOf? It seems to work fine.
... View more
08-26-2010
09:44 AM
|
0
|
0
|
490
|
POST
|
Thanks The first option gives me an error right away in designer (blue underline). If firstLayer.GetType().Equals(typeof(ESRI.ArcGIS.Carto.IFeatureLayer)) Then 'IFeatureLayer' is a type in 'Carto' and cannot be used as an expression. If firstLayer.GetType().ToString().Equals("ESRI.ArcGIS.Carto.IFeatureLayer") Then The second example gives me a run time error: Object reference not set to an instance of an object. I notice that when I type firstLayer. in the code window, the Intellisense doesn't give me an option for GetType. Is this in a library that I have to reference at the top of my code?
... View more
08-25-2010
10:51 AM
|
0
|
0
|
490
|
POST
|
This worked in VB6: dim firstLayer as ILayer
dim dataSet as IDataset
dim workSpace as IWorkspace
dim strWorkingPath as String
If TypeOf firstLayer Is IFeatureLayer Or TypeOf firstLayer Is IRasterLayer Then
dataSet = firstLayer
workSpace = dataSet.Workspace
strWorkingPath = workSpace.PathName
End If In VB.NET (VS 2005) they say to use GetType, but I can't find any examples that make any sense.
... View more
08-24-2010
01:04 PM
|
0
|
4
|
2094
|
POST
|
Under Project Properties, Compile, Advanced Compile Options Target CPU: x86 - I still get the same Immediate window messages on my x64 machine When I change to Target CPU: x64 I get these errors and warnings: Error 1 File "C:\TOOLS\Visual Studio 2005\Projects\DamMaker2_New\bin\Release\DamMaker2_New.dll" is not a valid assembly. DamMaker2_New Warning 2 Possible problem detected while building assembly 'DamMaker2_New': Referenced assembly 'mscorlib.dll' targets a different processor Warning 3 Possible problem detected while building assembly 'DamMaker2_New': Referenced assembly 'System.Data.dll' targets a different processor Since ArcMap is a 32 bit program, do I need to use a 32 bit OS to compile Visual Studio projects for ArcMap?
... View more
08-20-2010
12:45 PM
|
0
|
0
|
719
|
POST
|
It turns out that the error I was getting in the immediate window had nothing to do with why my code wasn't working. I went through my code line by line and cleaned it out. By adding Try, Catch blocks I was able to isolate the problem. ESRI Canada tech support helped me out. ArcMap.exe Error: 0 : SetCompatibleTextRenderingDefault must be called before the first IWin32Window object is created in the application.
at System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(Boolean defaultValue)
at XToolsNavigator.Toolbar.XToolsApplication.InitVisualApplicationSettings() I am still getting these error messages in the Immediate window when running my project in Debug mode, but it doesn't seem to stop the code from working properly. I do get error messages when I exit ArcMap sometimes even when I'm not in Debug mode, so it may have something to do with my system.
... View more
08-20-2010
11:20 AM
|
0
|
0
|
719
|
POST
|
Thanks Venkat I was able to figure out how to do it in Visual Basic 2005. (some of the code is omitted) Dim dataset As IDataset = fLayer.FeatureClass
dataset = fLayer.FeatureClass
Dim ftrClass As IFeatureClass = dataset
' Turn the new line feedback into a shape
Dim lineGeometry As IGeometry5
' Stop the feedback and put into geometry
lineGeometry = m_newLineFeedback.Stop
If Not lineGeometry Is Nothing Then
'' Save the digitized line in the new shapefile
Dim feature As IFeature
feature = ftrClass.CreateFeature
feature.Shape = lineGeometry
feature.Store()
... View more
08-20-2010
11:10 AM
|
0
|
0
|
323
|
Title | Kudos | Posted |
---|---|---|
2 | 08-29-2016 02:17 PM |
Online Status |
Offline
|
Date Last Visited |
02-18-2023
08:17 PM
|