[postgis-users] massive snap of points of one geometry to points of another geometry

Jose C. Martinez-Llario jomarlla at cgf.upv.es
Tue Nov 16 04:18:12 PST 2010


Hi all,
JASPA has a ST_SNAP function using JTS function. I guess with GEOS 
should be similar.
You can snap the segments and vertex of a geometry to the vertex of 
anotther one.

http://jaspa.forge.osor.eu/ST_Snap.html

Anyways, in my opinion this algorithm should be modified a little bit to 
use in a spatial database using real cartography.
Some interesting comments from Martin Davis to my question  in the jts list.


http://sourceforge.net/mailarchive/forum.php?thread_name=4C534B34.5090003%40cgf.upv.es&forum_name=jts-topo-suite-user


In JASPA 0.2 (maybe around march) a new system with topology rules and I 
think a tolerance system will be introduced.
Hope it helps,
Jose


public static Geometry ST_Snap(Geometry geom0, Geometry geom1, double 
tolerance) throws JASPAJTSException, JASPAGeomMismatchException {
         if (GeomProperties.errorIfDifferentSRIDorCoorDim (geom0, 
geom1)) return null;

         GeometrySnapper snapper = new GeometrySnapper(geom0);
         Geometry res = null;
         try {
             res = snapper.snapTo(geom1, tolerance);
             /*
             Geometry[] snapped = GeometrySnapper.snap(geom0, geom1, 
tolerance);
             if (snapped == null || snapped.length < 2) return null;

             Geometry res = snapped[0];
              */
         } catch (RuntimeException e) {
             //Catch the runtime JTS Exceptions
             Core.manageJTSExceptions(e);
         }

         return res;
     }


El 16/11/2010 13:04, Jan Hartmann escribió:
>
>
> On 11/15/10 18:03, strk wrote:
>>
>> The function exists within GEOS, which is a library used by PostGIS.
>> But the specific functionality (snapping) isn't exposed in SQL yet.
>>
>> What you could do is implement or fund implementation of
>> the missing bit (the wrapper).
>>
> I've always found snapping a very important function in all kinds of 
> (carto)graphic environments. Could you give an indication how much 
> time it would cost to write the PostGIS wrappers? If the algorithm 
> already exists in GEOS, exposing it in PostGIS doesn't look like a 
> major problem to me.
>
> Jan
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users




More information about the postgis-users mailing list