Hi Jody,

I was wrong, the HSQL database is available.

But the module is not able to identify the EPSG code from the .PRJ file in
order to withe the proper CRS, incl. the Bursa Wolf parameters.

I upload a shapefile with EPSG:3857

Geometry sourceGeometry (Geometry) simpleFeature.getDefaultGeometry();

gives me the following CRS

PROJCS["WGS_84_Pseudo_Mercator",****

  GEOGCS["GCS_WGS_1984",****

    DATUM["D_WGS_1984",****

      SPHEROID["WGS_1984", 6378137.0, 298.257223563]],****

    PRIMEM["Greenwich", 0.0],****

    UNIT["degree", 0.017453292519943295],****

    AXIS["Longitude", EAST],****

    AXIS["Latitude", NORTH]],****

  PROJECTION["Mercator_2SP"],****

  PARAMETER["standard_parallel_1", 0.0],****

  PARAMETER["latitude_of_origin", 0.0],****

  PARAMETER["central_meridian", 0.0],****

  PARAMETER["false_easting", 0.0],****

  PARAMETER["false_northing", 0.0],****

  UNIT["m", 1.0],****

  AXIS["x", EAST],

  AXIS["y", NORTH]]


**When I try to lookup the definition from the database ...

String sourceCode =CRS.lookup(sourceCRS,false|true);

... the result is null.


I can access the the database if I know the EPSG code and find **

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"]]
So, 3857 is in the database but cannot be found by the lookup with the
definition I get from the PRJ file.

So, is it possible to do it in a different way? The idea is to upload a
shapefile, let geotools identify the required transformation math and
transform the shapefile into a given projection.

Best regards,
Andreas




2013/6/21 jody.garnett [via OSGeo.org] <
[email protected]>

>  Interesting, check to see if gt-epsg-hsql is unpacking the database to a
> temp file, depending on your application server permissions it may fail at
> doing something like that.
>
> If not you are going to have to connect in with a debugger and step in and
> watch the code fail :D
>
> Note: uDig tried using H2 as an alternative, but it was never adopted by
> the wider geotools community.
>
> Jody
>
> --
> Jody Garnett
>
> On Thursday, 20 June 2013 at 8:31 AM, dodid wrote:
>
> Hi Jody,
>
> Thank You for the samples, meanwhile I implemented something which works
> fine as standalone Maven program, but as soon as I integrate this into an
> EAR and deploy it on a JBoss server the CRS.lookupIdentifier fails (returns
> null) (I in one occasion it was successfull but next time with the same
> setup it failed again)
>
> I use the same dependencies (gt-referencing, gt-epsg-hsql, gt-shapefile)
> and try to import the same shapefile.
> I have no other gt-epsg-* dependency in the project
>
> Any idea where I could search?
>
> Best regards
> Andreas
>
>
>
>
>
> 2013/6/19 jody.garnett [via OSGeo.org] <[hidden 
> email]<http://user/SendEmail.jtp?type=node&node=5061223&i=0>
> >
>
> When I load a shapefile and transform it to a shapefile with the same CRS
> everything is fine. But as soon as try to transform the shapefile with a
> different datum, the result is misplaced, or, if I turn of 'lenient',
> Geotools tells me that the Bursa Wolf parameters are missing.
>
> Are you reading this from a prj file?
>
> The WKT syntax provided by some tools does not always provided enough
> information for GeoTools
> to accurately make the transform.
>
> What you can do is look up the "official" definition that matches, and
> then proceed as normal.
>
> Is there a working example?
>
> The example works with the CoordinateReferenceSystem has enough
> information :-)
>
> Can Geotools identify the required Bursa Wolf parameters?
>
> It cannot make up information for you, but it can come close - hunt down
> an official definition that matches the information you do have.
>
> I was pretty sure I put an example in the docs - here it is:
> -
> http://docs.geotools.org/latest/userguide/library/referencing/crs.html#matching-a-coordinatereferencesystem
>
> I'm using Geotools 9.1 and have the dependencies gt-shapefile,
> gt-referencing, gt-swing and gt-epsg-hsql
>
> So if you stitch those two examples together you should get what you want.
> To be slightly more responsible you could either:
> - output a warning so users of your application know you are making stuff
> up
> - pop open the swing CRS Chooser and ask for user intervention
>
> All the best,
> Jody
>
> ------------------------------------------------------------------------------
>
> This SF.net email is sponsored by Windows:
>
> Build for Windows Store.
>
> http://p.sf.net/sfu/windows-dev2dev
> _______________________________________________
> GeoTools-GT2-Users mailing list
> [hidden email] <http://user/SendEmail.jtp?type=node&node=5060982&i=0>
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://osgeo-org.1560.x6.nabble.com/How-to-transform-shapes-with-different-datum-tp5060839p5060982.html
>  To unsubscribe from How to transform shapes with different datum?, click
> here.
> NAML<http://osgeo-org.1560.x6.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
>
>
> ------------------------------
> View this message in context: Re: How to transform shapes with different
> datum?<http://osgeo-org.1560.x6.nabble.com/How-to-transform-shapes-with-different-datum-tp5060839p5061223.html>
>
> Sent from the geotools-gt2-users mailing list 
> archive<http://osgeo-org.1560.x6.nabble.com/geotools-gt2-users-f4317834.html>at
> Nabble.com.
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Windows:
>
> Build for Windows Store.
>
> http://p.sf.net/sfu/windows-dev2dev
> _______________________________________________
> GeoTools-GT2-Users mailing list
> [hidden email] <http://user/SendEmail.jtp?type=node&node=5061461&i=0>
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
>
>
> ------------------------------------------------------------------------------
>
> This SF.net email is sponsored by Windows:
>
> Build for Windows Store.
>
> http://p.sf.net/sfu/windows-dev2dev
> _______________________________________________
> GeoTools-GT2-Users mailing list
> [hidden email] <http://user/SendEmail.jtp?type=node&node=5061461&i=1>
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://osgeo-org.1560.x6.nabble.com/How-to-transform-shapes-with-different-datum-tp5060839p5061461.html
>  To unsubscribe from How to transform shapes with different datum?, click
> here<http://osgeo-org.1560.x6.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5060839&code=YmVyZ21hbm4uaGhAZ21haWwuY29tfDUwNjA4Mzl8MjM1NjcwNjY1>
> .
> NAML<http://osgeo-org.1560.x6.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/How-to-transform-shapes-with-different-datum-tp5060839p5061684.html
Sent from the geotools-gt2-users mailing list archive at Nabble.com.
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to