[GeoNetwork-users] Conect google layers in mainmap

I'm trying to load a google layer but appears this error. Any idea?

2012-11-20 10:05:00,336 INFO [jeeves.request] - HTML Request (from
10.1.2.5) : /geonetwork/srv/ca/main.home
2012-11-20 10:05:00,336 DEBUG [jeeves.request] - Method : GET
2012-11-20 10:05:00,336 DEBUG [jeeves.request] - Content type : null
2012-11-20 10:05:00,336 DEBUG [jeeves.request] - Accept :
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
2012-11-20 10:05:00,336 DEBUG [jeeves.request] - Session id is
610DFF89FFF808AB910C58C350095953
2012-11-20 10:05:00,336 DEBUG [jeeves.request] - Session created for client
: 10.1.2.5
2012-11-20 10:05:00,352 INFO [jeeves.service] - Dispatching : main.home
2012-11-20 10:05:00,352 DEBUG [jeeves.service] - -> no input parameters
2012-11-20 10:05:00,352 INFO [jeeves.service] - -> dispatching to output
for : main.home
2012-11-20 10:05:00,430 DEBUG [jeeves.engine] - TransformerFactoryFactory:
de.fzi.dbs.xml.transform.CachingTransformerFactory
2012-11-20 10:05:00,445 DEBUG [jeeves.engine] - TransformerFactoryFactory:
produces transformer implementation net.sf.saxon.IdentityTransformer
2012-11-20 10:05:01,801 INFO [jeeves.service] - -> transforming with
stylesheet : C:\tomcat\webapps\geonetwork\/xsl/main-page.xsl
2012-11-20 10:05:01,801 DEBUG [jeeves.engine] - TransformerFactoryFactory:
de.fzi.dbs.xml.transform.CachingTransformerFactory
2012-11-20 10:05:01,801 DEBUG [jeeves.engine] - TransformerFactoryFactory:
produces transformer implementation net.sf.saxon.IdentityTransformer
2012-11-20 10:05:01,801 ERROR [jeeves.service] - -> exception during
transformation for : main.home
2012-11-20 10:05:01,801 ERROR [jeeves.service] - -> (C) stylesheet :
C:\tomcat\webapps\geonetwork\/xsl/main-page.xsl
2012-11-20 10:05:01,801 ERROR [jeeves.service] - -> (C) message :
Failed to compile stylesheet. 1 error detected.
2012-11-20 10:05:01,801 ERROR [jeeves.service] - -> (C) exception :
TransformerConfigurationException
2012-11-20 10:05:01,801 DEBUG [jeeves.service] - Raised exception while
executing service
<error id="error">
  <message>Failed to compile stylesheet. 1 error detected.</message>
  <class>TransformerConfigurationException</class>
  <stack>
    <at class="net.sf.saxon.PreparedStylesheet"
file="PreparedStylesheet.java" line="176" method="prepare" />
    <at class="net.sf.saxon.TransformerFactoryImpl"
file="TransformerFactoryImpl.java" line="139" method="newTemplates" />
    <at class="de.fzi.dbs.xml.transform.CachingTransformerFactory"
file="CachingTransformerFactory.java" line="115" method="newTransformer" />
    <at class="de.fzi.dbs.xml.transform.CachingTransformerFactory"
file="CachingTransformerFactory.java" line="70" method="newTransformer" />
    <at class="jeeves.utils.Xml" file="Xml.java" line="285"
method="transform" />
    <at class="jeeves.utils.Xml" file="Xml.java" line="247"
method="transform" />
    <at class="jeeves.utils.Xml" file="Xml.java" line="231"
method="transform" />
    <at class="jeeves.server.dispatchers.ServiceManager"
file="ServiceManager.java" line="711" method="dispatchOutput" />
    <at class="jeeves.server.dispatchers.ServiceManager"
file="ServiceManager.java" line="405" method="dispatch" />
    <at class="jeeves.server.JeevesEngine" file="JeevesEngine.java"
line="670" method="dispatch" />
  </stack>
  <request>
    <language>ca</language>
    <service>main.home</service>
  </request>
  <response />
</error>
2012-11-20 10:05:01,801 INFO [jeeves.service] - -> dispatching to error
for : main.home
2012-11-20 10:05:01,817 DEBUG [jeeves.engine] - TransformerFactoryFactory:
de.fzi.dbs.xml.transform.CachingTransformerFactory
2012-11-20 10:05:01,817 DEBUG [jeeves.engine] - TransformerFactoryFactory:
produces transformer implementation net.sf.saxon.IdentityTransformer
2012-11-20 10:05:01,832 INFO [jeeves.service] - -> transforming with
stylesheet : C:\tomcat\webapps\geonetwork\/xsl/error.xsl
2012-11-20 10:05:01,832 DEBUG [jeeves.engine] - TransformerFactoryFactory:
de.fzi.dbs.xml.transform.CachingTransformerFactory
2012-11-20 10:05:01,832 DEBUG [jeeves.engine] - TransformerFactoryFactory:
produces transformer implementation net.sf.saxon.IdentityTransformer
2012-11-20 10:05:02,269 INFO [jeeves.service] - -> end error
transformation for : main.home
2012-11-20 10:05:02,269 INFO [jeeves.service] - -> error ended for :
main.home

Thanks!
Víctor

--
View this message in context: http://osgeo-org.1560.n6.nabble.com/Conect-google-layers-in-mainmap-tp5016229p5017587.html
Sent from the GeoNetwork users mailing list archive at Nabble.com.

Hi!

I'm going to do a good-summary of what I did, just in case somebody can help
me. (I tried to start with the basic-level as
http://openlayers.org/dev/examples/google.html but it did'nt work, so I
tried to configure as Max explained)

So I started:

1- Edit c:\tomcat\webapps\geonetwork\web-inf\config-gui.xml

I added in the mapViewer options the google-layer as you can see

/<mapViewer options="{projection: 'EPSG:4326', maxExtent: new
OpenLayers.Bounds(-180,-90,180,90), units: 'degrees', restrictedExtent: new
OpenLayers.Bounds(-180,-90,180,90)}">
  <layers>
     *<googleLayer server="google" tocName="Google Satellite"
type="G_SATELLITE_MAP"</b>defaultLayer="true" />
  </layers>
/

2-Edit c:\tomcat\webapps\geonetwork\xsl\main-page.xsl

I added two times the library of google with my key code as you can see

/<xsl:choose>
            <xsl:when test="/root/request/debug">
          **
                
            </xsl:when>
            <xsl:otherwise>
        **
                  
            </xsl:otherwise>
        </xsl:choose>
/

3- Copy exactly the file ol_map.js
(http://131.220.109.2/geonetwork/scripts/ol_map.js) in
c:\tomcat\webapps\geonetwork\scripts\ol_map.js

4-Edit c:\tomcat\webapps\geonetwork\xsl\geo\utils.xsl

Add /<xsl:for-each select="/root/gui/config/mapViewer/layers/googleLayer">
        backgroundLayers.push(["<xsl:value-of
select='@tocName'/>","<xsl:value-of select='@server'/>","<xsl:value-of
select='@type'/>",<xsl:value-of select='@defaultLayer'/>]);
        </xsl:for-each>/ below /<xsl:for-each
select="/root/gui/config/mapViewer/layers/layer">
        backgroundLayers.push(["<xsl:value-of
select='@tocName'/>","<xsl:value-of select='@server'/>",<xsl:value-of
select='@params'/>, <xsl:value-of select='@options'/>]);
        </xsl:for-each>/

Finally I restarted my Tomcat. I runned debug version
/http://localhost:8080/geonetwork/srv/en/main.home?debug=true/ and normal
version /http://servergis:8080/geonetwork/srv/ca/main.home/

I add the pictures of errors (normal and debug).
Thanks and some help please!

<http://osgeo-org.1560.n6.nabble.com/file/n5017611/normal_error.jpg&gt;
<http://osgeo-org.1560.n6.nabble.com/file/n5017611/debug_error.jpg&gt;

--
View this message in context: http://osgeo-org.1560.n6.nabble.com/Conect-google-layers-in-mainmap-tp5016229p5017611.html
Sent from the GeoNetwork users mailing list archive at Nabble.com.

Hey Victor,

I suppose the * in front of defaultLayer is only a result of formatting in
the mail and is not existent in the code itself, right?

In addition I think you still haven´t set EPSG:900913 (the
google-projection) instead of EPSG:4326 in config-gui.xml. You also need to
adapt the extent then cause (-180,-90,180,90 are WGS84 aka
EPSG:4326-coordinates).

Nevertheless in my opinion you should first try making the simple way to
work (i.e. adding the google-layer based on the OpenLayers-example directly
within ol_map.js. If that´s not working the other solution won´t work as
well. Please experiment with it a bit and try to get familiar with
Firebug-debugging to see what´s going wrong while adding the google-layer in
the Javascript.

Best,
Max

Vaictor wrote

Hi!

I'm going to do a good-summary of what I did, just in case somebody can
help me. (I tried to start with the basic-level as
http://openlayers.org/dev/examples/google.html but it did'nt work, so I
tried to configure as Max explained)

[...]

I add the pictures of errors (normal and debug).
Thanks and some help please!

--
View this message in context: http://osgeo-org.1560.n6.nabble.com/Conect-google-layers-in-mainmap-tp5016229p5017853.html
Sent from the GeoNetwork users mailing list archive at Nabble.com.

Hi there,

I worked in the simple example and I created and html whick works perfectly
and upload all the google layers. The question is how to put some of this
code in the files of geonetwork.

The example which I did is:

<html>
  <head>
    <title>OpenLayers Google Layer Example</title>
    
  </head>
    <body onload="init()">
    <div id="map" style="width:500px; height:400px; border:1px solid
black;"></div>
  </body>
  </html>
  
Basically I need two references libraries (google and openstreetmaps). I
understand that all the libraries must be in main-page so I added twice in
main-page. Is there some other file I miss to added? Openlayers link library
is incluide in main-page so I think Is not needed to do anything with
openlayers library right?
And now the code, addlyaers, body onload init, div id="map"... how to aply
everything in GN. I did many tests but it didn't work.
Thanks everybody

Signature
(something we need some help)

--
View this message in context: http://osgeo-org.1560.n6.nabble.com/Conect-google-layers-in-mainmap-tp5016229p5017925.html
Sent from the GeoNetwork users mailing list archive at Nabble.com.

Hey,

Now I delete all the code of the file
c:\tomcat\webapps\geonetwork\scripts\ol_map.js and save the file totally
empty. Then I restart tomcat, I clean cookies but the map and functions and
everything work as I didn't delete anything. How is that possible??
Obviously all the things that I do in ol_map doesn't work cause GN don't
interpretate anything. Any idea, please help

Víctor

--
View this message in context: http://osgeo-org.1560.n6.nabble.com/Conect-google-layers-in-mainmap-tp5016229p5018204.html
Sent from the GeoNetwork users mailing list archive at Nabble.com.

Do you have "debug=true" in the url as mentioned by Jose in previous post. If
not then it is using the minified version.

--
View this message in context: http://osgeo-org.1560.n6.nabble.com/Conect-google-layers-in-mainmap-tp5016229p5018403.html
Sent from the GeoNetwork users mailing list archive at Nabble.com.

Yes I have debug. I'm woriking in the most basic example. Add layer in
ol_map.js

//**
     * Adds a layer to the map
     *
     */
    var createWmsLayer = function(name, url, params, options) {
        map.addLayer(new OpenLayers.Layer.WMS(name, url, params, options));
    };
     
  var gsat = new OpenLayers.Layer.Google(
                                "Google Satellite",
                                {type: G_SATELLITE_MAP, numZoomLevels: 22}
                );
        
  map.addLayer(gsat);

    var createDummyBaseLayer = function(extent) {
        var graphic = new OpenLayers.Layer.Image('Dummy',
'../../scripts/openlayers/img/blank.gif', extent,
                map.getSize(), {isBaseLayer: true, displayInLayerSwitcher:
false});
        map.addLayer(graphic);
    };

    /**
     * Configure the map controls
     *
     *//

And put the google library in main-page.xsl. (2 times)

Then I take "ol_map.js" put inside the source code, then compile with
eclipse, then take "gn.libs.map.js" and overwrite the file in my
webapplication. The compile is fine, I think there is some error but I don't
know how to do it. I'm close I know. Any idea???

--
View this message in context: http://osgeo-org.1560.n6.nabble.com/Conect-google-layers-in-mainmap-tp5016229p5018525.html
Sent from the GeoNetwork users mailing list archive at Nabble.com.