3

I'm trying to perform the reverse action to "display x/y". I have a point layer displayed on the map canvas, and I want to delete a point's geometry, as in remove it from the map, but retain the feature row and attributes in the layer's table.

I don't want to use any filters or symbology manipulations, just delete its physical geometry

Edit: Both methods worked, the in-tool expression is slightly more elegant IMO. the issues raised in the comments abou the validity of such a thing are correct, I should have said that this is a temporary solution during the process of updating point locations and working with a non-GIS person, so I had to, at least temporarily, retain all the features even if they aren't presented on a map.

  • I don't think so, but I suspect there are others here able to supply an authoritative answer for this than me. – PolyGeo Apr 12 '16 at 7:29
  • Copy to table. Table contains all the attributes of the record without a geometry – Midavalo Apr 12 '16 at 7:42
  • For it to have a geometry, I am thinking that your layer must be based on a feature class and that you are wanting a feature class that has some "features" with no geometries to be included in it. If that is what you mean, can you make it clearer in your question, please? Otherwise what @Midavalo suggests sounds like a solution. – PolyGeo Apr 12 '16 at 8:01
  • see gis.stackexchange.com/a/13177/64785 – Midavalo Apr 12 '16 at 8:06
  • When I have wanted to do something similar in the past, I have decided on a default location outside my regular map extent and changed the XY to that location for all features that I wanted "removed" so that the record and attributes remained but the point was never visible – Midavalo Apr 12 '16 at 8:11
5

Here is an even easier alternative to setting all geometries to NULL. For this to work you need to be in edit mode if you are processing a GeoDatabase FeatureClass.

This example shows how to set polygons to NULL

Field Calculate Tool

For a point dataset the expression needs to be:

arcpy.Point()

For a polyline dataset the expression needs to be:

arcpy.Polyline(arcpy.Array(None))
  • 1
    That's useful. Also, selecting a subset of features lets me change some, not all, to null. – HDunn Apr 13 '16 at 7:41
3

You can write an update cursor that replaces the shape field with NULLS. The following ArcPy works for a point geodatabase feature class at 10.3.1.

import arcpy
FC = "C:\\Data\\GIS\\My.gdb\\AreaOfInterest"

newPnt = arcpy.Point()

fieldList = arcpy.ListFields(FC,"","Geometry")
for field in fieldList:
    print field.name
    cursor = arcpy.UpdateCursor(FC)
    for row in cursor:
        geom = row.getValue(field.name)
        print "NULL Point Geometry"
        row.setValue(field.name, newPnt)
        cursor.updateRow(row)
  • you can but should you? I'd be worried that it has potential to create issues or corrupt the feature class. – Midavalo Apr 12 '16 at 8:59
  • 1
    There are legit cases that you might use this. Some mapping agencies create the row and attributes before an analyst captures the geometry. However that being said, you are correct. – GISI Apr 12 '16 at 9:06
  • 1
    I agree with GISI; I've been at projects where all the features must be present and then the geometry is updated. Other applications include legacy applications that work only with shapefiles and need to have "attribute table" full of rows, but the geometry is not needed, have seen this many times, too. – Alex Tereshenkov Apr 12 '16 at 9:12
  • 1
    The shapefile model permits null shapes in all shapefile geometry classes. Using them cannot corrupt the data table. The only question is whether non-Esri GIS applications handle the empty geometries correctly (if they don't, it's a serious defect). – Vince Apr 12 '16 at 11:03
0

As an afterthought, another way of achieving this is manually adding a row in edit mode, copying the attribute data from the point feature to the new row, and then deleting the original point feature.

It's crude, and time consuming, but hey, it works.

0

I apologize for bringing life into this old post, but in this case it might just be easier to export the table to a new file and work from there as opposed to deleting feature geometry.

Open the attribute table of said point layer, open Options > Export and you can save all or selected features into a variety of formats (dbf, csv..etc)

if you ever just need the attribute table without geometry you can always export a table. Usually very quick and easy.

doc link http://resources.arcgis.com/en/help/main/10.2/index.html#//005s0000001t000000

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.