I think you may want to back up and think about what is involved in transfer
over the network. We are focused on the spatial side of the problem; as such we
can give you code snippets that show how to use these geospatial classes with
normal Java facilities such as a Writer and Reader.
However what is involved to transfer over the network? Only you know what you
are doing for your application; personally I try to use Spring remoting; you
may be working with SOAP? Or perhaps just Java HTTP support? I am not sure ...
But yes Reader and Writer allow you to write to and from a Java String (when
using StringWriter and StringReader). If that helps you so much the better; if
your choice of remoting software allows you to accept an stream of input then
it is often preferable to use a Reader directly (so you that you can display
results to your users as contents are read in).
--
Jody Garnett
On Saturday, 30 April 2011 at 5:09 AM, mounir younes wrote:
> Also if someone can help me figure out what happens after reading and writing
> geoJSON ! is features simply transformed into strings? and then when read new
> features with the attributes read are being built ?
>
> So can I simply implement my own format and maybe send the IDs of the
> features over the network if the data is present at both ends ? Thank you
>
> On Fri, Apr 29, 2011 at 12:12 PM, mounir younes <[email protected]>
> wrote:
> > question 1: What does the assertEquals() and strip() methods do ?
> > And I want to send a feature collection with an OutputStream
> > (DataOutputStream or ObjectOutputStream) so should I do the following?
> >
> >
> > FeatureJSON fjson = new FeatureJSON();
> >
> > StringWriter writer = new StringWriter();
> > fjson.writeFeatureCollection(collection(), writer); //question 2 - does
> > this take the collection
> > and return it as a string and put it in string writer ? If yes ! does this
> > mean that
> > I can simply send it as a string over the network ?
> >
> > at the other end what should I read and how?
> > fjson.readFeatureCollection() ?
> > should I implement the collectionText() method ? if yes what does the
> > withBounds parameter mean ?
> >
> > Thank you :) I hope the answer for these questions would help others :)
> >
> > On Mon, Apr 25, 2011 at 11:34 AM, Andrea Aime
> > <[email protected]> wrote:
> > > On Mon, Apr 25, 2011 at 6:13 AM, Jody Garnett <[email protected]>
> > > wrote:
> > > > The work with a java Writer; use your http connection and wrap it up as
> > > > a
> > > > writer on one end; and a reader on the other; and use these two methods
> > > > as
> > > > shown above:
> > > >
> > > > - readFeatureCollection( reader )
> > > >
> > > > - writeFeatureCollection( featureCollection, writer )
> > > >
> > > > Or send a string over the wire (using whatever remoting software you are
> > > > happy with ) and use a StringWriter as shown in the test case to
> > > > generate
> > > > your string on one side; and a StringReader on the other end.
> > >
> > > To send over http you can use either commons http or use the built in Java
> > > abilities. If you go for the latter the bits of code in the
> > > resourceToStream method
> > > in this class might be of help (this is the receiving end, the other
> > > half is similar),
> > > in particular if the network is slow it shows how to use http 1.1 gzip
> > > compression
> > > to speed up the transfer:
> > >
> > > http://svn.osgeo.org/geotools/trunk/modules/unsupported/sfs/src/main/java/org/geotools/data/sfs/SFSDataStore.java
> > >
> > > Cheers
> > > Andrea
> > >
> > >
> > > --
> > > -------------------------------------------------------
> > > Ing. Andrea Aime
> > > GeoSolutions S.A.S.
> > > Tech lead
> > >
> > > Via Poggio alle Viti 1187
> > > 55054 Massarosa (LU)
> > > Italy
> > >
> > > phone: +39 0584 962313
> > > fax: +39 0584 962313
> > >
> > > http://www.geo-solutions.it
> > > http://geo-solutions.blogspot.com/
> > > http://www.youtube.com/user/GeoSolutionsIT
> > > http://www.linkedin.com/in/andreaaime
> > > http://twitter.com/geowolf
> > >
> > > -------------------------------------------------------
> > >
> >
>
------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network
management toolset available today. Delivers lowest initial
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users