Opened 8 years ago

Closed 8 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 8 years ago.
fatt_poly_01 - data exported to shape after setting grid=0.0000001
fatt_poly_05.zip (277.7 KB) - added by geognu 8 years ago.
fatt_poly_05 - data exported to shape after setting grid=0.5
fatt_poly_50.zip (27.3 KB) - added by geognu 8 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 Changed 8 years ago by robe

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

SELECT postgis_full_version();

Changed 8 years ago by geognu

Attachment: fatt_poly_01.zip added

fatt_poly_01 - data exported to shape after setting grid=0.0000001

Changed 8 years ago by geognu

Attachment: fatt_poly_05.zip added

fatt_poly_05 - data exported to shape after setting grid=0.5

Changed 8 years ago by geognu

Attachment: fatt_poly_50.zip added

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

comment:2 Changed 8 years ago by geognu

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 Changed 8 years ago by pramsey

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.