Opened 11 years ago

Closed 11 years ago

#2611 closed defect (worksforme)

ST_SnapToGrid doesn't snap

Reported by: geognu Owned by: pramsey
Priority: high Milestone: PostGIS 2.1.2
Component: postgis Version: 2.1.x
Keywords: Cc:

Description

Hi.

Testing various ST_SnapToGrid options looks like snapping is not working for values < 0.5, e.g. running the query

UPDATE mytable SET the_geom=ST_SnapToGrid(the_geom, 1)

I get the results, whilst

UPDATE mytable SET the_geom=ST_SnapToGrid(the_geom, 0.0000001)

doesn't work at all, leaving the geometry untouched.

Attachments (3)

fatt_poly_01.zip (581.4 KB ) - added by geognu 11 years ago.
fatt_poly_01 - data exported to shape after setting grid=0.0000001
fatt_poly_05.zip (277.7 KB ) - added by geognu 11 years ago.
fatt_poly_05 - data exported to shape after setting grid=0.5
fatt_poly_50.zip (27.3 KB ) - added by geognu 11 years ago.
fatt_poly_50 - data exported to shape after setting grid=50 (exxagerated for testing)

Download all attachments as: .zip

Change History (6)

comment:1 by robe, 11 years ago

Can you please state the version of PostGIS you are using and also provide sample data.

SELECT postgis_full_version();

by geognu, 11 years ago

Attachment: fatt_poly_01.zip added

fatt_poly_01 - data exported to shape after setting grid=0.0000001

by geognu, 11 years ago

Attachment: fatt_poly_05.zip added

fatt_poly_05 - data exported to shape after setting grid=0.5

by geognu, 11 years ago

Attachment: fatt_poly_50.zip added

fatt_poly_50 - data exported to shape after setting grid=50 (exxagerated for testing)

comment:2 by geognu, 11 years ago

postgis_full_version POSTGIS="2.1.1 r12113" GEOS="3.3.8-CAPI-1.7.8" PROJ="Rel. 4.8.0, 6 March 2012" LIBXML="2.9.1"

Files attached

comment:3 by pramsey, 11 years ago

Resolution: worksforme
Status: newclosed

I don't know how you're evaluating what "works" or not, but I can snap things just fine using 2.1

select st_astext(st_startpoint(st_exteriorring(st_geometryn(st_snaptogrid(geom,0.01),1)))) from fattibilita_poly_01;
Note: See TracTickets for help on using tickets.