Opened 14 years ago

Closed 13 years ago

#900 closed task (fixed)

shp2pgsql: a switch to drop M from 4d imports

Reported by: strk Owned by: pramsey
Priority: low Milestone: PostGIS 2.0.0
Component: utils/loader-dumper Version: master
Keywords: Cc:

Description

Annoyingly enough the only way for a shapefile to hold XYZ geometries is by having an M too. This in turn forces you to drop the M after import, if you know that the M really has no meaning.

Now, given the pain it is to convert a column's type (drop 2 constraints, update, re-add the constraints, update geometry columns), we might be nice and provide a switch for shp2pgsql to do that at import time directly.

Change History (9)

comment:1 by strk, 14 years ago

Component: postgisloader/dumper

comment:2 by pramsey, 13 years ago

Suppressing M looks to be not too hard, has only taken me about 10 minutes to get the core changed. But I'm thinking that once one can support M one might also thing suppressing Z is necessary too. So, another flag or a modal option? (Output 2d, output 3dm, output 3dz)

comment:3 by strk, 13 years ago

I'm for a modal option, we have so many switches already!

What about a -t switch which could grow in time ? Mnemonic: type. Semantic: you can specify a pattern to either _force_ or _filter_ on.

Do we also want to be able to _add_ an M or Z when missing ?

PS: is this really a 2.0 item?

comment:4 by pramsey, 13 years ago

Not necessarily a 2.0 item, but you wanted it and it's easy to implement, so why not? I should have enough moments this week to get it in.

comment:5 by strk, 13 years ago

lol, I forgot it was _me_ requesting it ! :)

Well I'm surely not in rush, especially since 2.0 will make it somewhat easier to do the drop later (no constraints to deal with).

The -t idea could be generally useful though. If we can get to design a comfortable syntax for it.

comment:6 by pramsey, 13 years ago

I was thinking something ugly like '-t z' or '-t zm' … hm, except that doesn't provide an option for forcing 2d. The programmers answer is a bitmask integer, 0-3. But that's not nice. tokens? 2D, 3DZ, 3DM, 4D?

comment:7 by strk, 13 years ago

The tokens one seems fine to me, I was thinking if we could include -S functionality in this new -t switch, something like -t Point, -t MultiLinestringZ, -t PolygonM, -t LineStringZM …

Adding the type would give you your ZM flags, but would require user to _know_ the type of the shapefile in advance, unless we have a way to split between type and dimension, like: -t Polygon:, -t Polygon:ZM

comment:8 by pramsey, 13 years ago

Code in trunk at r9204

comment:9 by pramsey, 13 years ago

Resolution: fixed
Status: newclosed

Docs in r9205

Note: See TracTickets for help on using tickets.