|
POST
|
I would think you have to use AccessWorkspaceFactory (esriDataSourcesGDB) instead of OLEDBWorkspaceFactory.
... View more
01-24-2011
11:26 AM
|
0
|
0
|
969
|
|
POST
|
Well the main thing is "hooking" the ArcMap document or the Application so you can work with the current document. In VBA, this is done by "ThisDocument". In VB.NET, ESRI has set up neat little snippets to grab the document from the application. Refer to this link for Snippet Help: http://edndoc.esri.com/arcobjects/9.2/NET/040b30ea-16e1-4dee-af9d-e2157c7d4ddb.htm This is an index of all the snippets available to you through the VS (Visual Studio) interface: http://resources.esri.com/help/9.3/ArcGISDesktop/dotnet/snippetreference.htm For other information, refer to this link: http://resources.esri.com/help/9.3/ArcGISDesktop/dotnet/concepts_start.htm
... View more
01-24-2011
11:16 AM
|
0
|
0
|
1180
|
|
POST
|
For the Horizonal and vertical alignment, the esriTHARight should begin with esriTextHorizontalAlignment so it would be esriTextHorizontalAlignment.esriTHARight Make sure the proper assemblies are loaded. If an interface is not recognized by the Visual Studio, it usually means it isn't added as a reference. Refer to this link for help with the IFontDisp stuff: http://edndoc.esri.com/arcobjects/9.2/NET/ca849e1d-5da3-4b64-90da-7a0cad7804f5.htm For the esriMSHALO you need to import the ESRI.ArcGIS.Display assembly into your project. It's a constant in esriMarkStyle category. So the code would be esriMarkStyle.esriMSHalo Other than that, you need to seek out documentation on how to migrate from VBA to VB.NET (Visual Studio).
... View more
01-24-2011
09:45 AM
|
0
|
0
|
1180
|
|
POST
|
I got it to work using the following code: Private Sub ProjShapefile()
Dim pGxApp As IGxApplication = m_application
Dim pGxObj As IGxObject = pGxApp.SelectedObject
If (TypeOf (pGxObj) Is GxShapefileDataset) = False Then
MsgBox("Make a valid Selection")
Exit Sub
End If
Dim pGxDataset As IGxDataset = pGxObj
Dim pDataset As IDataset = pGxDataset.Dataset
Dim pGeoDataset As IGeoDataset = pDataset
Dim pSpatRefFact As ISpatialReferenceFactory
Dim pPCS As IProjectedCoordinateSystem
Dim pSpatialRef As ISpatialReference
pSpatRefFact = New SpatialReferenceEnvironment
pPCS = pSpatRefFact.CreateProjectedCoordinateSystem(esriSRProjCSType.esriSRProjCS_NAD1983UTM_17N)
Dim pGeoDatasetEdit As IGeoDatasetSchemaEdit = pGeoDataset
If pGeoDatasetEdit.CanAlterSpatialReference = True Then
pGeoDatasetEdit.AlterSpatialReference(pPCS)
Else
MsgBox("error")
Exit Sub
End If
pGxApp.Refresh(pGxObj.Parent.FullName)
End Sub
... View more
01-18-2011
08:20 AM
|
0
|
0
|
351
|
|
POST
|
Hi all, I'm trying to automate a process that I constantly do manually in ArcCatalog. I export shapefiles from CAD and define their projection to NAD83 Zone 17 using ArcCatalog. I want to press a command button in ArcCatalog (in the toolbar) and have the selected shapefile be defined to NAD 83 Zone 17. Here's the code I have so far, but I can't seem to find away to cast the IGxObject to a feature layer to define it's projection..would I even have to cast it? Private Sub ProjectShapefile()
Try
Dim pGApp As IGxApplication = m_application
Dim pGxObj As IGxObject = pGApp.SelectedObject
Dim pGxDataset As IGxDataset
If (TypeOf (pGxObj) Is GxShapefileDataset) = False Then
'If pGxObj.Category <> "Shapefile" Then
MsgBox("Make a valid Selection")
Exit Sub
'End If
End If
Dim pSpatRefFact As ISpatialReferenceFactory
Dim pPCS As IProjectedCoordinateSystem
Dim pSpatialRef As ISpatialReference
pSpatRefFact = New SpatialReferenceEnvironment
pPCS = pSpatRefFact.CreateProjectedCoordinateSystem(esriSRProjCSType.esriSRProjCS_NAD1983UTM_17N)
Dim gxShape As GxShapefileDataset = New GxShapefileDataset
gxShape = pGxObj
pGxDataset = pGxObj
Dim pGeoDataset As IGeoDataset = pGxDataset
Dim pGeoDatasetEdit As IGeoDatasetSchemaEdit = gxShape
If pGeoDatasetEdit.CanAlterSpatialReference = True Then
' Alter the target layer's spatial reference
pGeoDatasetEdit.AlterSpatialReference(pPCS)
Else
Exit Sub
End If
' Get the spatial reference information and export it to a prj file
pSpatialRef = pGeoDataset.SpatialReference
pGApp.Refresh(pGxObj.Parent.FullName)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
... View more
01-18-2011
05:12 AM
|
0
|
1
|
799
|
|
POST
|
Thanks for the reply, i have read the article on migrating the code to ArcGIS 10. My problem is that i don't want to build two versions (in two separate computer) of my application because some users have ArcGis 9.3 and some ArcGis 10. I have a vb6 application and there's no problem, the same exe run with ArcGis 9.3 and 10. There is no way to use the same exe with ArcGis 9.3 and ArcGis 10 with vb.net ? I think you might have to compile two versions because some of the assemblies have changed. So some of the references you use in 9.3 SDK will not be supported in 10. Here's what I'm talking about: http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#/Migrating_ArcGIS_9_3_Desktop_and_Engine_custom_components_to_ArcGIS_10/0001000002m2000000/ Cheers
... View more
01-17-2011
04:31 AM
|
0
|
0
|
562
|
|
POST
|
Try out this thread... I asked this same question last year and someone helped me out. http://forums.arcgis.com/threads/4951-custom-toolbar-vb.net Best of luck.
... View more
01-14-2011
09:14 AM
|
0
|
0
|
902
|
|
POST
|
Hi, I have created multiple custom tools in VS 2008 and I want to add them to an add-in toolbar but i can't get it to work. When I create the toolbar I tried to add the Guid of the custom tools but they are not showing up in the toolbar when I add it to ArcMap. How do you add multiple custom tools to a custom toolbar? Thanks, Jessie Could we see the you're using to implement the GUIDs and which GUID are you using? (there are 3)
... View more
01-14-2011
09:10 AM
|
0
|
0
|
902
|
|
POST
|
You have to loop through the table of contents. You do this with a For loop: private void LayerName()
{
IMxDocument pMxDoc = default(IMxDocument);
IMap pMap = default(IMap);
IFeatureLayer pFeatureLayer = default(IFeatureLayer);
//Assign the mxDocument here..however you retrieved it...I usually use the snippet for retrieving the MxDoc from ArcMap
pMxDoc = ThisDocument;
pMap = pMxDoc.FocusMap;
// Loop through each layer, and report its name.
for (i = 1; i <= pMap.LayerCount; i++) {
pFeatureLayer = pMap.Layer(i);
Interaction.MsgBox("The name of layer is: " + pFeatureLayer.name);
}
}
SO you match the name you want with teh one that is returned in the loop instance and go from there..hope this helps.
... View more
11-26-2010
04:55 AM
|
0
|
0
|
351
|
|
POST
|
Hi, How do i create a Fillegeodatabase + import features(say point,line,polygon) from that using C# If somebody have sample(simple) code then it will b best... Thanks http://edndoc.esri.com/arcobjects/9.2/NET/fde31db0-af15-409f-81b5-75c23d4a762e.htm#CreateFGDB
... View more
11-25-2010
12:04 PM
|
0
|
0
|
965
|
|
POST
|
Can't you add a base command tool to your solution? Replace the curser (embedded resource) in there with your one and it should work no?
... View more
11-25-2010
12:02 PM
|
0
|
0
|
373
|
|
POST
|
I had to do this one for a class assignment last year. But what you need to do is create a base command that gets the selected feature from the feature class (make sure only 1 feature is selected). Use the ITopologicalOperator4 interface to cut the polygon (you must start an edit session on the workspace) by a polyline. The polyline can be programatically created using the envelope of the selected feature (if it's always a proportion of the selected feature, ex. Split the polygon in half). The ITopologicalOperator Interface will spit out 2 geometries that will be the left and right polygons. Store these as features and insert them into the feature class. Should be good to go. Obviously you have to do some work with the spatial references, starting and ending edit sessions, etc. Very doable. Good luck.
... View more
11-25-2010
11:32 AM
|
0
|
0
|
722
|
|
POST
|
Make sure when you compile your customizations that the compilation is explicitly set to x86.
... View more
11-25-2010
11:10 AM
|
0
|
0
|
878
|
|
POST
|
Can you post the code you have? Are you getting the values from an attribute table? I recommend you use a Streamwriter.writeline to write to a file. A lot better than the method you're using. Google Stream.writer for VB.NET and you'll get a lot of help. Also, make sure you use VB.NET in google. There's no such thing as VBA.NET.
... View more
11-25-2010
11:04 AM
|
0
|
0
|
621
|
|
POST
|
Can't anybody get advice how to transform Cartesian rectangular coordinates X,Y to geographical coordinates (latitude and longitude) and backwards? (I work with MapControl in arcgis Engine). I will be appreciated for any reference! Excuse me for title in russian! I don't have my Visual Studio handy right now but I'm pretty sure there's a snippet for this in the SDK Snippet library. Check it out.
... View more
10-22-2010
06:10 AM
|
0
|
0
|
285
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 08-30-2013 09:41 AM | |
| 4 | 01-09-2018 12:33 PM | |
| 2 | 10-06-2014 03:14 PM | |
| 2 | 08-13-2015 09:45 AM | |
| 1 | 08-14-2015 08:51 AM |
| Online Status |
Offline
|
| Date Last Visited |
08-12-2023
04:34 AM
|