Re: [postgis-users] Error on updating geometry column from two columns value

2011-12-01 Thread Firman Hadi

Dear Mike,

Thank you for the solutions. I will try it.
Thanks again.

Cheers,

Firman.

On 12/2/11 5:16 AM, Mike Toews wrote:

ST_GeomFromText turns WKT into a geometry, not SQL. You can either
format WKT (text) using:

ST_GeomFromText('POINT(' || NEW.koordinat_x || ', ' || NEW.koordinat_y
|| ')', 32748)

Or, a simpler/faster/lossless geometry constructor would be to pass
the floating point values directly to a point geometry:

ST_SetSRID(ST_MakePoint(NEW.koordinat_x, NEW.koordinat_y), 32748)

Note: you had your X/Y coordinates the other way around. PostGIS
coordinates are always ordered X/Y or long/lat.

-Mike

On 1 December 2011 20:31, Firman Hadijalmibur...@gmail.com  wrote:

Dear all,

I want to create one table with 3 columns (x, y, geom). I want to input the
x and y using form with PHP.
When I submit the form, it will trigger the new row.

I use this step below but when I insert the data I get the error as in
attachment.

I hope that anyone can help me to solve the problem.

Thank you in advance.

Kind regards,

Firman Hadi
Center for Remote Sensing - ITB
Indonesia




CREATE TABLE try_geometry (
 koordinat_y integer,
 koordinat_x integer,
 geom geometry PRIMARY KEY
  );


CREATE FUNCTION try_geometry_func () RETURNS trigger AS '
  BEGIN
 NEW.geometri = ST_GeomFromText('POINT(NEW.koordinat_y,
NEW.koordinat_x)',32748);
 RETURN NEW;
  END;
  ' LANGUAGE plpgsql;

===

CREATE TRIGGER try_geom_trg BEFORE INSERT OR UPDATE
 ON coba FOR EACH ROW
 EXECUTE PROCEDURE try_geometry_func ();

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] Good Mac app for editing Shape (.shp) files?

2011-11-29 Thread Firman Hadi
I've tried several programs, such as QGIS, uDIG, GRASS, even using 
PostGIS (based on Paul Ramsey's presentation Postgis Power). From those, 
IMO, the best one is GRASS. You can see in v.digit whether the line is 
closed or not, the centroid is within one poligon etc. You can see 
double lines in GRASS, in QGIS you can only see one line.


Regards,

Firman Hadi
Center for Remote Sensing - ITB
Indonesia


On 11/29/11 12:27 AM, René Fournier wrote:

I've noticed some irregularities/mistakes in certain polygons describing state 
borders in a shape file I downloaded. I would like to correct the mistakes — 
basically remove some of the points along certain line segments, and move the 
position of other lines — then re-import into Postgresql. Can anyone recommend 
a good [free] app for Mac OS X that lets one edit shape files visually?

Thanks.

…Rene

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users



___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users