R: R: [postgis-users] precision of GeomFromTex, Transform and text functions
Ludovico Bianchini
metlud at yahoo.it
Tue Sep 4 08:50:57 PDT 2007
Hi,
you have centered the problem.
With lon-lat couples situated in Italy it's work.
The wrong longitude (I was convinced that 37 was in
Italy) was born using java mapscript (a mapserver
related component) to calculate a test value,
converting the coords of a point in Treviso:
x = 1752000f;
y = 5062000f;
point.setX(x);
point.setY(y);
point.project(new projectionObj("init=EPSG:26591"),
new projectionObj("init=EPSG:4326"));
point.toString();//37.13953463591601 45.66405322544534
So I've now understood that the problem is not in
postgis but in the epsg values that java mapscript
uses in conversions. I'll search in this direction.
Thank you very much for your helpful replies!!
--- P.Rizzi Ag.Mobilità Ambiente
<paolo.rizzi at ama-mi.it> ha scritto:
> There's no FROMWGS parameter, TOWGS is all that's
> needed,
> as far as I know.
> Problem may be that the coordinates you are using
> have
> a longitude (37.xxxx) not inside Italy (actually
> they apper to be
> somewhere in southern Russia near the Georgia
> border).
> If you do the insert/select using coordinates like:
> 9.13953463591601 45.66405322544534
>
> it should work as expected.
>
> Bye
> Paolo Rizzi
>
>
> > -----Messaggio originale-----
> > Da: postgis-users-bounces at postgis.refractions.net
> >
>
[mailto:postgis-users-bounces at postgis.refractions.net]Per
> conto di
> > Ludovico Bianchini
> > Inviato: martedì 4 settembre 2007 16.02
> > A: PostGIS Users Discussion
> > Oggetto: Re: R: [postgis-users] precision of
> GeomFromTex,Transform and
> > text functions
> >
> >
> > Thanks for the suggestion, actually there were not
> the
> > toWGS parameter in spatial_ref_sys table.
> >
> > The situation seems to be a little better (here a
> > sequence of insert-select:
> > Insert:37.13953463591601 45.66405322544534
> > Select:37.1321637582786 45.6647731135686
> >
> > Insert:37.1321637582786 45.6647731135686
> > Select:37.1248123607135 45.6654908577754
> >
> > Insert:37.1248123607135 45.6654908577754
> > Select:37.1174803443424 45.6662064695791), but the
> > error is still too big.
> >
> > I have this question: is there a parameter
> simmetric
> > to TOWGS? If so the project library shall use
> FROMWGS
> > to convert from the gps system and TOWGS to
> convert to
> > the gps system.
> > Sorry if the question is stupid, but I don't
> > understand how to solve this problem (to convert
> gps
> > (SRID=4326) to West Gauss Boaga Italy Rome Monte
> Mario
> > (SRID=26591 or 3003).
> >
> > Any help will be very appreciated!!!
> >
> > Ludovico
> >
> >
> > --- P.Rizzi Ag.Mobilità Ambiente
> > <paolo.rizzi at ama-mi.it> ha scritto:
> >
> > > I forget to mention the fact that inside the
> PostGIS
> > > spatial_ref_sys
> > > table, TOWGS parameters are missing for
> EPSG:26591
> > > and for 3003 too.
> > > So any transform will not be precise in any
> case.
> > > To add parameters for EPSG:3003, you can use the
> > > following SQL
> > > in any DB that you need to.
> > >
> > > Bye
> > > Paolo Rizzi
> > >
> > >
> > > ---
> > > --- To add TOWGS parameters, if needed, to:
> > > ---
> > > --- EPSG 3003 : Monte Mario / Italy zone 1
> > > ---
> > > --- If parameters are already present, no change
> > > will take place.
> > > ---
> > > UPDATE "spatial_ref_sys" SET
> > > "srtext"='PROJCS["Monte Mario / Italy zone
> > > 1",GEOGCS["Monte
> > >
> Mario",DATUM["Monte_Mario",SPHEROID["International
> > >
> >
>
1924",6378388,297,AUTHORITY["EPSG","7022"]],TOWGS84[-104.1,-49
> >
>
.1,-9.9,0.971,-2.917,0.714,-11.68],AUTHORITY["EPSG","6265"]],P
> >
>
RIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.
> >
>
01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","
> >
>
4265"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_
> >
>
of_origin",0],PARAMETER["central_meridian",9],PARAMETER["scale
> >
>
_factor",0.9996],PARAMETER["false_easting",1500000],PARAMETER[
> >
>
"false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],A
> > UTHORITY["EPSG","3003"]]'
> > > WHERE "srid"=3003 AND "auth_name"='EPSG' AND
> > > "srtext" NOT LIKE '%TOWGS%';
> > >
> > > UPDATE "spatial_ref_sys" SET
> > > "proj4text"='+proj=tmerc +lat_0=0 +lon_0=9
> > > +k=0.999600 +x_0=1500000 +y_0=0 +ellps=intl
> +units=m
> > > +no_defs
> > >
> >
>
+towgs84=-104.1,-49.1,-9.9,0.971,-2.917,0.714,-11.68'
> > > WHERE "srid"=3003 AND "auth_name"='EPSG' AND
> > > "proj4text" NOT LIKE '%towgs%';
> > >
> > >
> > >
> > >
> > > > -----Messaggio originale-----
> > > > Da:
> postgis-users-bounces at postgis.refractions.net
> > > >
> > >
> >
>
[mailto:postgis-users-bounces at postgis.refractions.net]Per
> > > conto di
> > > > P.Rizzi Ag.Mobilità Ambiente
> > > > Inviato: martedì 4 settembre 2007 11.25
> > > > A: PostGIS Users Discussion
> > > > Oggetto: R: [postgis-users] precision of
> > > > GeomFromTex,Transform and text
> > > > functions
> > > >
> > > >
> > > > Probably it does not matter to you in this
> case,
> > > > but EPSG:26591 has been deprecated in favour
> of
> > > EPSG:3003.
> > > > There is an error (can't remember what) in
> 26591.
> > > >
> > > > Bye
> > > > Paolo Rizzi
> > > >
> > > >
> > > > > -----Messaggio originale-----
> > > > > Da:
> > > postgis-users-bounces at postgis.refractions.net
> > > > >
> > >
> >
>
[mailto:postgis-users-bounces at postgis.refractions.net]Per
> > > conto di
> > > > > Ludovico Bianchini
> > > > > Inviato: lunedì 3 settembre 2007 21.39
> > > > > A: postgis-users at postgis.refractions.net
> > > > > Oggetto: [postgis-users] precision of
> > > GeomFromTex,Transform and text
> > > > > functions
> > > > >
> > > > >
> > > > > Hi all,
> > > > >
> > > > > I'm using this postgis function:
> > > > > - GeomFromText(text, int4) to create a
> geometry
> > > value
> > > > > in 4326 spatial_ref_sys
> > > > > - Transform(geometry, int4) to convert a
> > > geometry from
> > > > > 4326 to 26591 when I'm inserting a record
> and to
> > > > > convert 26591 to 4326 when I'm selecting
> records
> > > > > - text(geometry) to convert the geometry
> column
> > > in a
> > > > > human-readable string
> > > > >
> > > > > The problem is that the operations are not
> > > precise:
> > > > > the value I obtain via
> > > text(transorm(geom_column,
> > > > > 4326)) is different from what I inserted via
>
>
=== message truncated ===
___________________________________
L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail: http://it.docs.yahoo.com/nowyoucan.html
More information about the postgis-users
mailing list