I have a couple of Shapefiles which are of geometry type ZM (like PolygonZM
, MultiLineStringZM
, etc.), however my database (a PostGIS database) is of geometry type Z (like PolygonZ
, MultiPointZ
, etc.). When I import my shapefile into database, it will of course report an error. However, when I convert these Shapefiles, I find that M values cannot be removed without removing Z value.
Here are my efforts:
1. In ArcMap, use Feature Class to Feature Class in ArcToolbox, click "Environment" and disable M value there. However, output Shapefiles still have M values.
2. Using Export in QGIS, and choose PolygonZ
or other geometry types with Z only in SHPT
field. Again, output Shapefiles still have M values.
3. Use ogr2ogr
. Here is the command line:
ogr2ogr -nlt polygonz new.shp old.shp
Again, output Shapefiles still have M values.
However, if I discard Z values as well:
ogr2ogr -nlt polygon new.shp old.shp
Output Shapefiles will have neither Z nor M values.
But when I try to add Z again, like:
ogr2ogr -nlt polygonz new1.shp new.shp
Both Z and M will be added, thus returning to PolygonZM
.
Since these shapefiles have no actual Z values at all, I can safely discard Z values along with M values if I only need to deal with these files themselves. However, in my database, geometry columns are storing Z values, and they cannot be discarded. Can anyone tell me why can't I just discard M values and preserve Z values for these Shapefiles?