[Geoserver-users] Help with attempt at translating projection

I am attempting to translate a projection and it does not seem to be working correctly. It is a map of North America, and here is what I built to include in the epsg.properties file:

69036406=PROJCS["Lambert Azimuthal Equal Area", GEOGCS["NAD83", DATUM["North_American_Datum_1983", SPHEROID["GRS 1980", 6378137,298.257222],TOWGS84[1.0, 1.0, -1.0, 0.0, 0.0, 0.0, 0.0]], PRIMEM["Greenwich",0], UNIT["Meter",1]], PROJECTION["Lambert_Azimuthal_Equal_Area"], PARAMETER["False_Easting",0], PARAMETER["False_Northing",0], PARAMETER["Latitude_Of_Origin",45],UNIT["Meter",1],AUTHORITY["EPSG","69036406"]]

I'm guessing it has some issues, but I don't know what they are. I am using Geoserver 1.6, and I used what I could find in the documentation for the map I'm using. I'm unsure of some of the formatting issues as well. Does anybody have any suggestions?

Regards,

Amy

Amy Johnson ha scritto:

I am attempting to translate a projection and it does not seem to be working correctly. It is a map of North America, and here is what I built to include in the epsg.properties file:

69036406=PROJCS["Lambert Azimuthal Equal Area", GEOGCS["NAD83", DATUM["North_American_Datum_1983", SPHEROID["GRS 1980", 6378137,298.257222],TOWGS84[1.0, 1.0, -1.0, 0.0, 0.0, 0.0, 0.0]], PRIMEM["Greenwich",0], UNIT["Meter",1]], PROJECTION["Lambert_Azimuthal_Equal_Area"], PARAMETER["False_Easting",0], PARAMETER["False_Northing",0], PARAMETER["Latitude_Of_Origin",45],UNIT["Meter",1],AUTHORITY["EPSG","69036406"]]

I'm guessing it has some issues, but I don't know what they are. I am using Geoserver 1.6, and I used what I could find in the documentation for the map I'm using. I'm unsure of some of the formatting issues as well. Does anybody have any suggestions?

What does it mean "it's not working correctly"? :slight_smile:
I mean, is the parser telling you the above code is invalid (I haven't checked it), is the projected map not as where you thought it would be?
There are many ways to have a projection go wrong. Help us helping you :slight_smile:

Cheers
Andrea

Very good points :wink: When I type it into the field for SRS on the
FeatureTypes page then click "Generate", I get the following error message:

  *GeoServer - Exception*

The following exception was thrown:
java.lang.reflect.InvocationTargetException

I just assumed I had formatted it incorrectly or left out necessary
information.

Andrea Aime wrote:

Amy Johnson ha scritto:

I am attempting to translate a projection and it does not seem to be working correctly. It is a map of North America, and here is what I built to include in the epsg.properties file:

69036406=PROJCS["Lambert Azimuthal Equal Area", GEOGCS["NAD83", DATUM["North_American_Datum_1983", SPHEROID["GRS 1980", 6378137,298.257222],TOWGS84[1.0, 1.0, -1.0, 0.0, 0.0, 0.0, 0.0]], PRIMEM["Greenwich",0], UNIT["Meter",1]], PROJECTION["Lambert_Azimuthal_Equal_Area"], PARAMETER["False_Easting",0], PARAMETER["False_Northing",0], PARAMETER["Latitude_Of_Origin",45],UNIT["Meter",1],AUTHORITY["EPSG","69036406"]]

I'm guessing it has some issues, but I don't know what they are. I am using Geoserver 1.6, and I used what I could find in the documentation for the map I'm using. I'm unsure of some of the formatting issues as well. Does anybody have any suggestions?

What does it mean "it's not working correctly"? :slight_smile:
I mean, is the parser telling you the above code is invalid (I haven't checked it), is the projected map not as where you thought it would be?
There are many ways to have a projection go wrong. Help us helping you :slight_smile:

Cheers
Andrea

Amy Johnson ha scritto:

Very good points :wink: When I type it into the field for SRS on the
FeatureTypes page then click "Generate", I get the following error message:

*GeoServer - Exception*

The following exception was thrown:
java.lang.reflect.InvocationTargetException

If you look in the GeoServer log you'll find a longer explaination (a stack trace).
Anwyays, I'll have a look at the definition you pasted.

Cheers
Andrea

I can take a look at it first. It will give me more of an understanding of Geoserver if I at least try to fix it. I won't get a chance to until this evening though.

Amy

----- Original Message -----
From: Andrea Aime <aaime@anonymised.com>
Date: Tuesday, September 11, 2007 8:11 am
Subject: Re: [Geoserver-users] Help with attempt at translating projection
To: Amy Johnson <ajohnson@anonymised.com>
Cc: geoserver users <geoserver-users@lists.sourceforge.net>

Amy Johnson ha scritto:
> Very good points :wink: When I type it into the field for SRS on the
> FeatureTypes page then click "Generate", I get the following
error message:
>
>
> *GeoServer - Exception*
>
> The following exception was thrown:
> java.lang.reflect.InvocationTargetException

If you look in the GeoServer log you'll find a longer explaination
(a
stack trace).
Anwyays, I'll have a look at the definition you pasted.

Cheers
Andrea

I tested running Geoserver with and without the additional projection. In both cases, I got the same error in geoserver/data/logs/geoserver.log. It was:

2007-09-12 16:32:11,722 WARN [geoserver.global] - loading plugins
java.lang.NullPointerException
at org.vfny.geoserver.global.GeoValidator.loadPlugins(GeoValidator.java:79)
at org.vfny.geoserver.global.GeoValidator.(GeoValidator.java:60)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:100)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:75)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:669)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:329)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:226)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:176)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:105)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.resolveConstructorArguments(AbstractAutowireCapableBeanFactory.java:713)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:611)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:329)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:226)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:176)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:105)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.resolveConstructorArguments(AbstractAutowireCapableBeanFactory.java:713)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:611)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:329)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:226)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:275)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:318)
at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:134)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:230)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:156)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:48)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3830)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4337)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)

When I entered the number for my projection, this log did not change. I found the following in tomcat/logs/localhost.2007-09-12.log, but the numbers do not seem to refer to my projection:

Sep 12, 2007 4:42:09 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet action threw exception
org.opengis.parameter.InvalidParameterValueException: Value 2,578.31 is out of range [-90…90].
at org.geotools.parameter.Parameter.ensureValidValue(Parameter.java:275)
at org.geotools.parameter.Parameter.setValue(Parameter.java:594)
at org.geotools.referencing.wkt.Parser.parseProjection(Parser.java:597)
at org.geotools.referencing.wkt.Parser.parseProjCS(Parser.java:879)
at org.geotools.referencing.wkt.Parser.parseCoordinateReferenceSystem(Parser.java:240)
at org.geotools.referencing.wkt.Parser.parseCoordinateReferenceSystem(Parser.java:221)
at org.geotools.referencing.factory.PropertyAuthorityFactory.createCoordinateReferenceSystem(PropertyAuthorityFactory.java:382)
at org.geotools.referencing.factory.BufferedAuthorityFactory.createCoordinateReferenceSystem(BufferedAuthorityFactory.java:715)
at org.geotools.referencing.factory.FallbackAuthorityFactory.createCoordinateReferenceSystem(FallbackAuthorityFactory.java:587)
at org.geotools.referencing.factory.FallbackAuthorityFactory.createCoordinateReferenceSystem(FallbackAuthorityFactory.java:587)
at org.geotools.referencing.factory.AuthorityFactoryAdapter.createCoordinateReferenceSystem(AuthorityFactoryAdapter.java:744)
at org.geotools.referencing.factory.ThreadedAuthorityFactory.createCoordinateReferenceSystem(ThreadedAuthorityFactory.java:707)
at org.geotools.referencing.CRS.decode(CRS.java:415)
at org.geotools.referencing.CRS.decode(CRS.java:349)
at org.vfny.geoserver.form.data.TypesEditorForm.setSRS(TypesEditorForm.java:701)

Any ideas of where I should look? Also, is there any complete documentation for the fields that are included in a user defined projection?

Thanks,

Amy

Amy Johnson wrote:

Amy Johnson ha scritto:

I am attempting to translate a projection and it does not seem to be working correctly. It is a map of North America, and here is what I built to include in the epsg.properties file:

69036406=PROJCS["Lambert Azimuthal Equal Area", GEOGCS["NAD83", DATUM["North_American_Datum_1983", SPHEROID["GRS 1980", 6378137,298.257222],TOWGS84[1.0, 1.0, -1.0, 0.0, 0.0, 0.0, 0.0]], PRIMEM["Greenwich",0], UNIT["Meter",1]], PROJECTION["Lambert_Azimuthal_Equal_Area"], PARAMETER["False_Easting",0], PARAMETER["False_Northing",0], PARAMETER["Latitude_Of_Origin",45],UNIT["Meter",1],AUTHORITY["EPSG","69036406"]]

Ok, it took me some code debugging to understand the issue but
I now understand what's going on.

The trouble lies in the unit you declared in the Datum, which is meter,
and does not make sense for an ellipsoid (should be either radians or degrees).
I think the WKT parser falls back on the default, which is radians, and that's why it chokes when it parses the latitude of origin, 45 in radians does not make sense.

The following amended definition works (remember to type it in
a single line in the property file):
PROJCS["Lambert Azimuthal Equal Area",
   GEOGCS["NAD83",
     DATUM["North_American_Datum_1983",
       SPHEROID["GRS 1980", 6378137.0, 298.257222],
       TOWGS84[1.0, 1.0, -1.0, 0.0, 0.0, 0.0, 0.0]],
     PRIMEM["Greenwich", 0.0],
     UNIT["degree", 0.017453292519943295],
     AXIS["Longitude", EAST],
     AXIS["Latitude", NORTH]],
   PROJECTION["Lambert_Azimuthal_Equal_Area"],
   PARAMETER["latitude_of_center", 45.0],
   PARAMETER["longitude_of_center", 0.0],
   PARAMETER["false_easting", 0.0],
   PARAMETER["false_northing", 0.0],
   UNIT["m", 1.0],
   AXIS["x", EAST],
   AXIS["y", NORTH],
   AUTHORITY["EPSG","69036406"]]

As for how to build up a proper WKT definition, I frankly usually
pick up one that looks like the one I want from the GeoServer
SRS list and then alter it slightly.

You can also find a formal definition here:
http://geoapi.sourceforge.net/2.0/javadoc/org/opengis/referencing/doc-files/WKT.html

Hope this helps
Cheers
Andrea

Thanks Andrea, I appreciate the effort. I don't completely understand, but that's another issue. I will go through it and sort it out to the best of my ability. Thanks for the reference.

Amy

Andrea Aime wrote:

Amy Johnson ha scritto:

I am attempting to translate a projection and it does not seem to be working correctly. It is a map of North America, and here is what I built to include in the epsg.properties file:

69036406=PROJCS["Lambert Azimuthal Equal Area", GEOGCS["NAD83", DATUM["North_American_Datum_1983", SPHEROID["GRS 1980", 6378137,298.257222],TOWGS84[1.0, 1.0, -1.0, 0.0, 0.0, 0.0, 0.0]], PRIMEM["Greenwich",0], UNIT["Meter",1]], PROJECTION["Lambert_Azimuthal_Equal_Area"], PARAMETER["False_Easting",0], PARAMETER["False_Northing",0], PARAMETER["Latitude_Of_Origin",45],UNIT["Meter",1],AUTHORITY["EPSG","69036406"]]

Ok, it took me some code debugging to understand the issue but
I now understand what's going on.

The trouble lies in the unit you declared in the Datum, which is meter,
and does not make sense for an ellipsoid (should be either radians or degrees).
I think the WKT parser falls back on the default, which is radians, and that's why it chokes when it parses the latitude of origin, 45 in radians does not make sense.

The following amended definition works (remember to type it in
a single line in the property file):
PROJCS["Lambert Azimuthal Equal Area",
  GEOGCS["NAD83",
    DATUM["North_American_Datum_1983",
      SPHEROID["GRS 1980", 6378137.0, 298.257222],
      TOWGS84[1.0, 1.0, -1.0, 0.0, 0.0, 0.0, 0.0]],
    PRIMEM["Greenwich", 0.0],
    UNIT["degree", 0.017453292519943295],
    AXIS["Longitude", EAST],
    AXIS["Latitude", NORTH]],
  PROJECTION["Lambert_Azimuthal_Equal_Area"],
  PARAMETER["latitude_of_center", 45.0],
  PARAMETER["longitude_of_center", 0.0],
  PARAMETER["false_easting", 0.0],
  PARAMETER["false_northing", 0.0],
  UNIT["m", 1.0],
  AXIS["x", EAST],
  AXIS["y", NORTH],
  AUTHORITY["EPSG","69036406"]]

As for how to build up a proper WKT definition, I frankly usually
pick up one that looks like the one I want from the GeoServer
SRS list and then alter it slightly.

You can also find a formal definition here:
http://geoapi.sourceforge.net/2.0/javadoc/org/opengis/referencing/doc-files/WKT.html

Hope this helps
Cheers
Andrea

Le jeudi 13 septembre 2007 à 21:20 -0800, Amy Johnson a écrit :

> The trouble lies in the unit you declared in the Datum, which is meter,
> and does not make sense for an ellipsoid (should be either radians or
> degrees).
> I think the WKT parser falls back on the default, which is radians,
> and that's why it chokes when it parses the latitude of origin, 45 in
> radians does not make sense.

Thanks Andrea for investigating this issue. The WKT parser should at the
very least emmits a warning when an inconsistent unit is found rather
than fallback silently. I created a JIRA task for that:

http://jira.codehaus.org/browse/GEOT-1495

  Martin