R: [postgis-users] JtsBinaryWriter and SRIDs

P.Rizzi Ag.Mobilità Ambiente paolo.rizzi at ama-mi.it
Mon Mar 27 05:25:58 PST 2006


> Hi, Paolo,
> 
> P.Rizzi Ag.Mobilità Ambiente wrote:
> 
> 
> > I can set the SRID of the geometry instances, but not the 
> one of their
> > factory and,
> > since JtsBinaryWriter uses the one from the factory, I 
> cannot change it.
> 
> That's an interesting point. Initially, I implemented it using the
> geometry SRID methods. The reason why I changed to the GeometryFactory
> methods was because Geometry.getSrid and Geometry.setSrid were
> deprecated in JTS 1.6.
> 
> It seems that this has changed in 1.7. The code is 
> effectively the same,
> but the methods are not deprecated any more.
I never used JTS before, so I didn't know that. Anyway it seems sensible to
me
that they have un-deprecated them, but I may be wrong...
In any case I submitted a similar message to the JTS list, because I have
the
same issue with their OracleWriter class, so I may have an answer from that
part.

> 
> Re-Changing it back to the Geometry SRID attributes will allow me to
> abandon the ugly GeometryFactory cache, and thus liften the build
> dependency on trove4j.
I just use JtsBinaryWriter and JtsBinaryParser directly, without the
Wrappers
and JtsGeometry, so I can't say anything about this.
I do this for two reasons: the first is to avoid the dependency on Trove,
the other is that I don't want to have classes automatically registered 
with the Postgres JDBC connection.
Maybe it's just me, but since sometime I'm copying from Postgis to Postgis,
I have no need to waste time interpreting the WKB string, I just copy it
straight from one DB to the other, so a PGobject is the best (and faster)
thing.

> 
> However, it'll break potential apps that depend on the 
> Geometry Factory
> SRID being equal to the Geomery SRID.
Note that we're talking about the JtsBinaryWriter, not the JtsBinaryParser,
so the two SRIDs may already be different.
The problem is choosing one or the other to write out to Postgis.
When you'll re-read them, the two will be equal, because each geometry
will be built by the same factory, with the same SRID.
Anyway, for the writer, the behaviour could be configurable,
so the default would be to use the factory SRID, but use the instance SRID 
upon request.
> 
> What do you think about it?
I have to patch the source code anyway and  I'll send it to you.

> 
> 
> HTH,
> Markus
			Bye		Paolo




AVVERTENZE AI SENSI DEL D. LGS. 196/2003  
Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i
file/s allegato/i, sono da considerarsi strettamente riservate. Il loro
utilizzo è consentito esclusivamente al destinatario del messaggio, per le
finalità indicate nel messaggio stesso. Qualora riceveste questo messaggio
senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia
via e-mail e di procedere alla distruzione del messaggio stesso,
cancellandolo dal Vostro sistema; costituisce comportamento contrario ai
principi dettati dal D. Lgs. 196/2003 il trattenere il messaggio stesso,
divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
utilizzarlo per finalità diverse.



More information about the postgis-users mailing list