[postgis-users] How to get a java.awt.Polygon from a postgis wkb geometry column?

Kevin Neufeld kneufeld at refractions.net
Fri Jul 6 09:14:09 PDT 2007

java.awt.Polygon?  It's not very efficient, but you could try to read 
the PostGIS geometry as WKB using JTS 
(http://www.vividsolutions.com/JTS/JTSHome.htm), then iterate through 
the coordinates in the exterior ring, extracting the raw x,y to pass as 
an argument to java.awt.Polygon (int[] xpoints, int[] ypoints, int npoints)

This thread has some thoughts to read from a PostGIS database:

Hope this helps.
-- Kevin

Stefan Zweig wrote:
> hi list,
> i am just wondering how i can draw to screen a Poylgon (or a Polyline/Point) which is stored in a postgis db?
> i have geographical coordinates stored in a table with the geometry coloumn being in the wkb format. i know, how to connect to my postgres db and how to query the geometry from that table (e.g. select the_geom from testtable where...). now i would need some javaclasses/javamethods which create Polygons (Polylines/Point) as i walk through the result set. i know that there is a wkb4j library, but unfortunately this badly documented and i don't know how to use it.
> has anybody experiences with that issue? i would appreciate any help.
> thanks in advance, stefan
> _______________________________________________________________________
> Jetzt neu! Schützen Sie Ihren PC mit McAfee und WEB.DE. 3 Monate
> kostenlos testen. http://www.pc-sicherheit.web.de/startseite/?mc=022220
> _______________________________________________
> 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