Example: Edit a Shapefile In Place

In this example we learn how to edit ESRI shapefiles  "in place," that is, leaving the data in the shapefile and only linking it into a project and not importing it into the project.

Link a Shapefile into the Project

To edit a file in place we can either link it into the project or create a new data source using the file.   For connections to more complex data such tables within an Oracle database, we would create a new data source using File - Create - New Data Source.   For simple files like shapefiles we will link it into the project using File - Link.




We launch Manifold and then choose File - Link.




In the Link dialog we browse into the folder where our shapefiles are located, we click on the .shp file and then press Open.





The link appears in the project as a database cylinder, indicating the data is hosted outside of the project.  We click on the + plus icon to expand it.






Within the linked data hierarchy we double-click on the states drawing to open it. The drawing shows provinces ("states") in Mexico.   Note that the database cylinder now has an asterisk sub-icon to indicate it has been used and thus may have been changed.


Assign Initial Coordinate System

The shapefiles we linked did not have a .prj file, so as experienced operators we know the shapefile does not specify the coordinate system used by the drawing.  Before we edit the drawing we will assign an initial coordinate system.





Clicking on the Contents pane we see that Manifold has detected the spatially brain-dead lack of a .prj file, has provisionally assigned a placeholder coordinate system of Pseudo-Mercator, and is reporting the coordinate system using red text to warn us it is a provisional assignment.  Manifold wants us to assign an initial coordinate system manually, since the shapefile fails to do so.  Note that if we failed to notice the lack of a .prj file, or failed to notice the red text in the Contents pane, we might notice the strange coordinates reported in the Status bar when we move the mouse cursor over Mexico.




Easy to do:  we click on the coordinate picker button and see the only option is to Assign Initial Coordinate System.   That unfolds a menu that allow us to launch the full Coordinate System dialog with a choice of thousands of systems, choose one of the two Favorites built into Manifold, or to edit the Favorite Coordinate Systems dialog.   We know this particular shapefile uses Latitude / Longitude projection so that is what we choose.





The Latitude / Longitude system appears in the Contents pane, which uses black text to report it, indicating the initial coordinate system has been assigned.  The Status bar now reports expected coordinates, right about where Mexico should be, when we move the mouse cursor over the drawing.   Onward to editing...

Edit the Drawing


When we edit the drawing that is in the linked shapefile we are editing the shapefile.   To demonstrate, we will do two simple edits.  First we will delete some objects from the drawing and then next we will edit a field in the drawing's table.






Ctrl-click on some of the area objects to select them.






Press the Delete key or choose Edit - Delete and they are deleted.


Edit a Record

We will now make a small change to a record.






Double-click the states Table table to open it.   





We double-click into the PROVINCE cell for the province of Durango and we edit it to use a mix of upper and lower case.  Press Enter to close the edit..






We press Ctrl-Enter to commit the edit and then we choose File - Save to save the project as Edit a Shapefile.map.  This saves changes to the linked shapefile as well.






The linked data's database cylinder no longer has an * asterisk sub-icon since we have saved the changes.

Verify the Shapefile has been Edited

Now that we have edited the shapefile in place, we can try importing it into a new blank project to see if we have indeed made the edits we intended.   We choose File - New to close the project and to open a new, blank project.





Choose File - Import.




In the Import dialog we browse over to the shapefile, click it to highlight it and then press Open.   Note that in the file folder there is now a .mapcache file that Manifold wrote when we edited the shapefile, to make it easier and quicker for Manifold to use the shapefile again.






The shapefile imports as a drawing and the drawing's table.  We double-click on the drawing to open it.   We see that the provinces we deleted are indeed deleted.  Note also from the Status bar readout that the coordinates are strange.   We have not yet assigned the initial coordinate system to the drawing, which was imported from a shapefile that still lacks a .prj.   If instead of linking the shapefile we had imported the shapefile and then exported it with the changes we made, Manifold would have written a .prj file to the shapefile ensemble.   But by linking the shapefile in place we leave it in as original condition as possible excepting the edits made.





We double-click on the table to open that as well.  We can see that the edit we made to the PROVINCE field for the province of Durango has indeed happened: the name of the province is in mixed case.


Shapefiles have limitations as discussed in the SHP, Shapefiles  topic.   For example, a shapefile can contain only points, or only lines or only areas, but not a mix of points, lines and areas.   Because of that limitation of shapefile format we could have edited this shapefile to add a square shape to it, for example, but we could not have edited it to add group of points or lines.

See Also

File - Export


Assign Initial Coordinate System


Change Coordinate System


SHP, Shapefiles


Example: Import a Shapefile - ESRI shapefiles are a very popular format for publishing GIS and other spatial data.  Unfortunately, shapefiles often will not specify what projection should be used.  This example shows how to deal with that quickly and easily.


Latitude and Longitude are Not Enough


Shapefiles Strangely Out of Shape


Three Letter Extensions