thanks a lot but i made an abstract class with two static methods as below..
*
public* *static* JSONObject GeomWktToGeoJson(String wkt) *throws* Exception
{
WKTReader2 wktReader = *new* WKTReader2();
Geometry g = (Geometry) wktReader.read(wkt);
GeometryJSON j = *new* GeometryJSON();
Object obj=JSONValue.*parse*(j.toString(g));
JSONObject array=(JSONObject)obj;
//System.out.println(array.toJSONString());
*return* array;
}
*public* *static* JSONObject GeomToGeoJson(Geometry g) *throws* Exception
{
GeometryJSON j = *new* GeometryJSON();
Object obj=JSONValue.*parse*(j.toString(g));
JSONObject array=(JSONObject)obj;
//System.out.println(array.toJSONString());
*return* array;
}
On Fri, Jul 29, 2011 at 9:02 AM, Michael Bedward
<[email protected]>wrote:
> On 29 July 2011 00:47, Justin Deoliveira <[email protected]> wrote:
> > A related note that geoscript (which ships with all the necessary jars)
> > makes this a one liner. Ok two lines with imports.
> >>>> from geoscript.geom import readWKT, writeJSON
> >>>> writeJSON(readWKT('POINT ( 8136668.86140000 3590334.97430000)'))
> > u'{"type":"Point","coordinates":[8136668.8614,3590334.9743]}'
>
> Nice !
>
> Michael
>
>
> ------------------------------------------------------------------------------
> Got Input? Slashdot Needs You.
> Take our quick survey online. Come on, we don't ask for help often.
> Plus, you'll get a chance to win $100 to spend on ThinkGeek.
> http://p.sf.net/sfu/slashdot-survey
> _______________________________________________
> Geotools-gt2-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
--
I.R
------------------------------------------------------------------------------
Got Input? Slashdot Needs You.
Take our quick survey online. Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users