Hola.
¿Hay una manera de calcular los valores de Z para un archivo shp de un atributo de campo que contiene valores de elevación en ArcGIS 9.3 que no sea editando el archivo shp y de introducir los valores manualmente?
Una vez hecho esto, es posible convertir los puntos (con los valores de z) a una línea (con cada punto como un vértice), que conserva los valores de z?
Cualquier idea, por favor hágamelo saber.
Gracias,
Calcular o agregar valores Z a un shp en ArcGIS
Re: Calcular o agregar valores Z a un shp
En ArcGIS 9.3, abres la tabla de atributos y en el campo Z con clic derecho seleccionas Field Calculator. Dentro de Field Calculator activar Advanced. ahí pegas el siguiente código:
Código:
en el botón de Field Calculator ajustar SHAPE = [SHAPE]
Esto permite actualizar la geometría de los valores del campo Z en el campo llamado "zFIELD" en los atributos de la tabla.
espero haberte ayudado...
Código:
Código: Seleccionar todo
Dim pPoint As IPoint
Set pPoint = [SHAPE]
pPoint.Z = [zFIELD]
Esto permite actualizar la geometría de los valores del campo Z en el campo llamado "zFIELD" en los atributos de la tabla.
espero haberte ayudado...
Re: Calcular o agregar valores Z a un shp
En ArcGIS 10, existe una herramienta en python script que se llama Point to Line that will work.
Ahora en ArcGIS 9.3, puedes usar el código que dejo al final. este código requiere una capa de puntos como la primera capa en tu mapa (se puede modificar muy facilmente) y también te toca actualizar el directorio de tu geodatabase. Puedes copiar y pegar este código en VBA Editor de ArcMap.
Ahora en ArcGIS 9.3, puedes usar el código que dejo al final. este código requiere una capa de puntos como la primera capa en tu mapa (se puede modificar muy facilmente) y también te toca actualizar el directorio de tu geodatabase. Puedes copiar y pegar este código en VBA Editor de ArcMap.
Código: Seleccionar todo
Public Sub New_Polyline()
Dim pMxd As IMxDocument
Set pMxd = ThisDocument
Dim pMap As IMap
Set pMap = pMxd.FocusMap
Dim pFlyr As IFeatureLayer
Set pFlyr = pMap.Layer(0) 'First layer in map; needs to be a Point layer
Dim pPtCol As IPointCollection, pPolyLine As IPolyline
Dim pFC As IFeatureClass, pFeat As IFeature
Dim pFeatCursor As IFeatureCursor
Set pFC = pFlyr.FeatureClass
Set pFeatCursor = pFC.Search(Nothing, False)
Set pFeat = pFeatCursor.NextFeature
Set pPolyLine = New Polyline
Dim pZA As IZAware
Set pZA = pPolyLine
pZA.ZAware = True
Set pPtCol = pZA
'Iterate to add points to the collection
Do Until pFeat Is Nothing
pPtCol.AddPoint pFeat.Shape
Set pFeat = pFeatCursor.NextFeature
Loop
Dim pFWork As IFeatureWorkspace
Set pFWork = OpenFileGDBWorkspace("C:\temp\TEST.gdb")
Dim pOutFeatureClass As IFeatureClass
Set pOutFeatureClass = CreateFC(pFWork, "newPolyLine", pMap.SpatialReference)
Dim pFCInsert As IFeatureCursor
Dim pFeatInsert As IFeatureBuffer
Set pFeatInsert = pOutFeatureClass.CreateFeatureBuffer
Set pFeatInsert.Shape = pPolyLine
Set pFCInsert = pOutFeatureClass.Insert(True)
Call pFCInsert.InsertFeature(pFeatInsert)
Dim pFeatureLayer As IFeatureLayer
Set pFeatureLayer = New FeatureLayer
Set pFeatureLayer.FeatureClass = pOutFeatureClass
pFeatureLayer.name = pOutFeatureClass.AliasName
pMap.AddLayer pFeatureLayer
pMap.MoveLayer pFeatureLayer, pMap.LayerCount - 1 'optional move beneath point layer
'Refresh the table of contents and the map
pMxd.UpdateContents
Dim pActiveView As IActiveView
Set pActiveView = pMap
Call pActiveView.Refresh
End Sub
Private Function OpenFileGDBWorkspace(path As String) As IWorkspace
Dim pWorkFactory As IWorkspaceFactory
Set pWorkFactory = New FileGDBWorkspaceFactory
Set OpenFileGDBWorkspace = pWorkFactory.OpenFromFile(path, 0)
End Function
Private Function CreateFC(pFWork As IFeatureWorkspace, name As String, pSpatRef As ISpatialReference)
Set CreateFC = pFWork.CreateFeatureClass(name, GetShapeFields(pSpatRef), Nothing, Nothing, esriFTSimple, "Shape", "")
End Function
Private Function DrawPolylineGraphic(pMap As IMap, pPtCol As IPointCollection)
'If you don't want to create a feature class use this function
'Use GraphicsContainer so Redraw doesn't erase line
Dim pActiveView As IActiveView
Dim pGraphicsContainer As IGraphicsContainer
Dim pElement As IElement
Dim pGeom As IGeometry
Set pActiveView = pMap
Set pGraphicsContainer = pMap
Set pElement = New LineElement
Set pGeom = pPtCol
pElement.Geometry = pGeom
pGraphicsContainer.AddElement pElement, 0
pActiveView.PartialRefresh esriViewGraphics, Nothing, Nothing
End Function
Private Function GetShapeFields(pSpatRef As ISpatialReference) As IFields
Dim pFields As IFieldsEdit
Dim pField As IFieldEdit
Dim pGeoDef As IGeometryDef
Set pGeoDef = New GeometryDef
Dim pGeoDefE As IGeometryDefEdit
Set pFields = New Fields
'OID Field
Set pField = New Field
pField.name = "ObjectId"
pField.AliasName = "ObjectId"
pField.Type = esriFieldType.esriFieldTypeOID
Call pFields.AddField(pField)
'Shape Field
Set pField = New Field
With pField
.name = "Shape"
.AliasName = "Shape"
.Type = esriFieldType.esriFieldTypeGeometry
End With
'Geometry Definition
Set pGeoDefE = pGeoDef
With pGeoDefE
.GeometryType = esriGeometryType.esriGeometryPolyline
.GridCount = 1
.GridSize(0) = 0
.HasZ = True
Set .SpatialReference = pSpatRef
End With
Set pField.GeometryDef = pGeoDefE
Call pFields.AddField(pField)
Set GetShapeFields = pFields
End Function
Re: Calcular o agregar valores Z a un shp en ArcGIS
Si quieres agregar coordenadas Z a una shapefile (shp) en arcgis, primero debes contar con un DEM o un TIN.
Luego desde el ArcToolbox > 3D Analyst Tools > Functional Surface > Add Surface Information.
En el primer campo seleccionas el shp, en el segundo campo el TIN o DEM y en el tercer campo seleccionas Z.
espero haber ayudado ...
Saludos desde Ecuador.
Luego desde el ArcToolbox > 3D Analyst Tools > Functional Surface > Add Surface Information.
En el primer campo seleccionas el shp, en el segundo campo el TIN o DEM y en el tercer campo seleccionas Z.
espero haber ayudado ...
Saludos desde Ecuador.