You are unlikely to get a reply to this, simply because GeoTools uses the EPSG 
database as provided. We tend to be relaed about what we import (supporting the 
use of alias if needed to import WKT from different systems).

-- 
Jody Garnett

On 12 October 2013 at 9:13:43 AM, Sergei Kozyrenko (ser...@faspark.com) wrote:

Hello,
I'm trying to use both PostGIS and GeoTools with the same ESPG:3857 projection, 
however, it looks like the projections in PostGIS and GeoTools differ. 

This is what I have in PostGIS:
"PROJCS[""WGS 84 / Pseudo-Mercator"",GEOGCS[""WGS 
84"",DATUM[""WGS_1984"",SPHEROID[""WGS 
84"",6378137,298.257223563,AUTHORITY[""EPSG"",""7030""]],AUTHORITY[""EPSG"",""6326""]],PRIMEM[""Greenwich"",0,AUTHORITY[""EPSG"",""8901""]],UNIT[""degree"",0.0174532925199433,AUTHORITY[""EPSG"",""9122""]],AUTHORITY[""EPSG"",""4326""]],UNIT[""metre"",1,AUTHORITY[""EPSG"",""9001""]],PROJECTION[""Mercator_1SP""],PARAMETER[""central_meridian"",0],PARAMETER[""scale_factor"",1],PARAMETER[""false_easting"",0],PARAMETER[""false_northing"",0],EXTENSION[""PROJ4"",""+proj=merc
 +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m 
+nadgrids=@null +wktext  
+no_defs""],AUTHORITY[""EPSG"",""3857""],AXIS[""X"",EAST],AXIS[""Y"",NORTH]]"

Here's GeoTools:
PROJCS["WGS 84 / Pseudo-Mercator", 
  GEOGCS["WGS 84", 
    DATUM["World Geodetic System 1984", 
      SPHEROID["WGS 84", 6378137.0, 298.257223563, AUTHORITY["EPSG","7030"]], 
      AUTHORITY["EPSG","6326"]], 
    PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]], 
    UNIT["degree", 0.017453292519943295], 
    AXIS["Geodetic latitude", NORTH], 
    AXIS["Geodetic longitude", EAST], 
    AUTHORITY["EPSG","4326"]], 
  PROJECTION["Popular Visualisation Pseudo Mercator", 
AUTHORITY["EPSG","1024"]], 
  PARAMETER["semi_minor", 6378137.0], 
  PARAMETER["latitude_of_origin", 0.0], 
  PARAMETER["central_meridian", 0.0], 
  PARAMETER["scale_factor", 1.0], 
  PARAMETER["false_easting", 0.0], 
  PARAMETER["false_northing", 0.0], 
  UNIT["m", 1.0], 
  AXIS["Easting", EAST], 
  AXIS["Northing", NORTH], 
  AUTHORITY["EPSG","3857"]]

I've tried using the PostGIS one with GeoTools, but it cannot parse it due to 
the EXTENSION element. Of course, I could update PostGIS with the GeoTools one, 
but can anyone tell why they are different? 

I'm using GeoTools 10.0, and just trying to convert a EPSG:4326 point into 
EPSG:3857, and vice versa. The code works:
CoordinateReferenceSystem sourceCRS = CRS.decode("EPSG:4326");
            CoordinateReferenceSystem targetCRS = CRS.decode("EPSG:3857");
            Logger.info(targetCRS.toWKT());
            MathTransform transform = CRS.findMathTransform(sourceCRS, 
targetCRS, false);
            GeometryFactory geometryFactory = new GeometryFactory(new 
PrecisionModel(), DEFAULT_GEOM);
            Point point = geometryFactory.createPoint(
                    new Coordinate(lon, lat));
            Point targetPoint = (Point) JTS.transform(point, transform);

but I cannot use the targetPoint I create in PostGIS queries. Any solution of 
how to make these two work together?
------------------------------------------------------------------------------  
October Webinars: Code for Performance  
Free Intel webinars can help you accelerate application performance.  
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from  
the latest Intel processors and coprocessors. See abstracts and register >  
http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk_______________________________________________
  
GeoTools-GT2-Users mailing list  
GeoTools-GT2-Users@lists.sourceforge.net  
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users  
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to