[GeoNetwork-users] Spatial extent background map is not shown

Hi,

When I open metadata there is no background map in Spatial Extent. Settings
are default and same .war is working ok on my computer. Where could the
problem be and what sould I check in logs...?

<http://osgeo-org.1560.x6.nabble.com/file/n5255116/HsaEZeB.png&gt;

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Spatial-extent-background-map-is-not-shown-tp5255116.html
Sent from the GeoNetwork users mailing list archive at Nabble.com.

Hi,

What is the link of your image ?
Do you have any error ?

Is your database up to date ?

On Tue, Mar 8, 2016 at 2:58 PM, amacar <amadej.pevec@anonymised.com> wrote:

Hi,

When I open metadata there is no background map in Spatial Extent. Settings
are default and same .war is working ok on my computer. Where could the
problem be and what sould I check in logs...?

<http://osgeo-org.1560.x6.nabble.com/file/n5255116/HsaEZeB.png&gt;

--
View this message in context:
http://osgeo-org.1560.x6.nabble.com/Spatial-extent-background-map-is-not-shown-tp5255116.html
Sent from the GeoNetwork users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://makebettercode.com/inteldaal-eval
_______________________________________________
GeoNetwork-users mailing list
GeoNetwork-users@lists.sourceforge.net
geonetwork-users List Signup and Options
GeoNetwork OpenSource is maintained at
GeoNetwork - Geographic Metadata Catalog download | SourceForge.net

--
*camptocamp*
INNOVATIVE SOLUTIONS
BY OPEN SOURCE EXPERTS

*Florent Gravin*
0479444492

Link is:
http://prostor4.gov.si/imps/srv/slv/region.getmap.png?mapsrs=EPSG:3857&width=250&background=osm&geomsrs=EPSG:4326&geom=Polygon((13%2045,17%2045,17%2047,13%2047,13%2045))
<http://prostor4.gov.si/imps/srv/slv/region.getmap.png?mapsrs=EPSG:3857&width=250&background=osm&geomsrs=EPSG:4326&geom=Polygon((13%2045,17%2045,17%2047,13%2047,13%2045))>

Database is oracle and is the same as our development database, but on
development environment everything is working ok.
About errors, I don't have access to logs right now (it is deployed on
production), that is why I am asking (if maybe someone had the same problem
and solved it successfully) where and what should I check when I get access.

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Spatial-extent-background-map-is-not-shown-tp5255116p5255288.html
Sent from the GeoNetwork users mailing list archive at Nabble.com.

Problem was, that GetMap.java class is not using proxy settings.

We solved with this piece of code
(https://github.com/geonetwork/core-geonetwork/blob/develop/services/src/main/java/org/fao/geonet/services/region/GetMap.java#L272).

            Proxy proxy = null;
      
      boolean useProxy =
settingManager.getValueAsBool(SettingManager.SYSTEM_PROXY_USE, false);
            if (useProxy) {
                String proxyHost =
settingManager.getValue(SettingManager.SYSTEM_PROXY_HOST);
                String proxyPort =
settingManager.getValue(SettingManager.SYSTEM_PROXY_PORT);
                //String username =
settingManager.getValue(SettingManager.SYSTEM_PROXY_USERNAME);
                //String password =
settingManager.getValue(SettingManager.SYSTEM_PROXY_PASSWORD);
        proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyHost,
Integer.valueOf(proxyPort)));
            }
            
            InputStream in = null;
            try {
                URL imageUrl = new URL(background);
                in = useProxy ?
imageUrl.openConnection(proxy).getInputStream() : imageUrl.openStream();
                image = ImageIO.read(in);
            } catch (IOException e) {
                image = new BufferedImage(imageDimensions.width,
imageDimensions.height, BufferedImage.TYPE_INT_ARGB);
                error = e;
            }finally {
                if(in != null) {
                    IOUtils.closeQuietly(in);
                }

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Spatial-extent-background-map-is-not-shown-tp5255116p5261372.html
Sent from the GeoNetwork users mailing list archive at Nabble.com.

Hi

We face similar issue in other project. I'll commit the fix we did in the
project, we added a similar code in NetLib class.

*GetMap.java*

URLConnection conn = Lib.net.setupProxy(context, imageUrl);
in = conn.getInputStream();

*NetLib.java*

public URLConnection setupProxy(ServiceContext context, URL url)
throws IOException
{
    GeonetContext gc = (GeonetContext)
context.getHandlerContext(Geonet.CONTEXT_NAME);
    SettingManager sm = gc.getBean(SettingManager.class);

    boolean enabled = sm.getValueAsBool(ENABLED, false);
    String host = sm.getValue(HOST);
    String port = sm.getValue(PORT);
    String username= sm.getValue(USERNAME);
    String password= sm.getValue(PASSWORD);
    String ignoreHostList = sm.getValue(IGNOREHOSTLIST);

    URLConnection conn = null;
    if (enabled) {
        if (!Lib.type.isInteger(port)) {
            Log.error(Geonet.GEONETWORK, "Proxy port is not an integer
: "+ port);
        } else {
            if (!isProxyHostException(url.getHost(), ignoreHostList)) {

                InetSocketAddress sa = new InetSocketAddress(host,
Integer.parseInt(port));
                Proxy proxy = new Proxy(Proxy.Type.HTTP, sa);
                conn = url.openConnection(proxy);

                if (username.trim().length() != 0) {
                    String encodedUserPwd = new
Base64().encodeAsString((username + ":" + password).getBytes());
                    conn.setRequestProperty("Accept-Charset", "UTF-8");
                    conn.setRequestProperty("Proxy-Authorization",
"Basic " + encodedUserPwd);
                }

            } else {
                conn = url.openConnection();
            }
        }
    } else {
        conn = url.openConnection();
    }

    return conn;
}

I'll commit the fix soon.

Regards,

Jose García

On Fri, Apr 15, 2016 at 9:15 AM, amacar <amadej.pevec@anonymised.com> wrote:

Problem was, that GetMap.java class is not using proxy settings.

We solved with this piece of code
(
https://github.com/geonetwork/core-geonetwork/blob/develop/services/src/main/java/org/fao/geonet/services/region/GetMap.java#L272
).

            Proxy proxy = null;

                        boolean useProxy =
settingManager.getValueAsBool(SettingManager.SYSTEM_PROXY_USE, false);
            if (useProxy) {
                String proxyHost =
settingManager.getValue(SettingManager.SYSTEM_PROXY_HOST);
                String proxyPort =
settingManager.getValue(SettingManager.SYSTEM_PROXY_PORT);
                //String username =
settingManager.getValue(SettingManager.SYSTEM_PROXY_USERNAME);
                //String password =
settingManager.getValue(SettingManager.SYSTEM_PROXY_PASSWORD);
                                proxy = new Proxy(Proxy.Type.HTTP, new
InetSocketAddress(proxyHost,
Integer.valueOf(proxyPort)));
            }

            InputStream in = null;
            try {
                URL imageUrl = new URL(background);
                in = useProxy ?
imageUrl.openConnection(proxy).getInputStream() : imageUrl.openStream();
                image = ImageIO.read(in);
            } catch (IOException e) {
                image = new BufferedImage(imageDimensions.width,
imageDimensions.height, BufferedImage.TYPE_INT_ARGB);
                error = e;
            }finally {
                if(in != null) {
                    IOUtils.closeQuietly(in);
                }

--
View this message in context:
http://osgeo-org.1560.x6.nabble.com/Spatial-extent-background-map-is-not-shown-tp5255116p5261372.html
Sent from the GeoNetwork users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications
Manager
Applications Manager provides deep performance insights into multiple
tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
GeoNetwork-users mailing list
GeoNetwork-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geonetwork-users
GeoNetwork OpenSource is maintained at
http://sourceforge.net/projects/geonetwork

--

*Vriendelijke groeten / Kind regards,Jose García
<http://www.geocat.net/&gt;Veenderweg 136721 WD BennekomThe NetherlandsT: +31
(0)318 416664 <+31318416664> <https://www.facebook.com/geocatbv&gt;
<https://twitter.com/geocat_bv&gt;
<https://plus.google.com/u/1/+GeocatNetbv/posts&gt;Please consider the
environment before printing this email.*

Hi

The code fix is committed to 3.0.5, see
https://github.com/geonetwork/core-geonetwork/issues/1528

Regards,
Jose García

On Fri, Apr 15, 2016 at 10:30 AM, Jose Garcia <jose.garcia@anonymised.com>
wrote:

Hi

We face similar issue in other project. I'll commit the fix we did in the
project, we added a similar code in NetLib class.

*GetMap.java*

URLConnection conn = Lib.net.setupProxy(context, imageUrl);
in = conn.getInputStream();

*NetLib.java*

public URLConnection setupProxy(ServiceContext context, URL url) throws IOException
{
    GeonetContext gc = (GeonetContext) context.getHandlerContext(Geonet.CONTEXT_NAME);
    SettingManager sm = gc.getBean(SettingManager.class);

    boolean enabled = sm.getValueAsBool(ENABLED, false);
    String host = sm.getValue(HOST);
    String port = sm.getValue(PORT);
    String username= sm.getValue(USERNAME);
    String password= sm.getValue(PASSWORD);
    String ignoreHostList = sm.getValue(IGNOREHOSTLIST);

    URLConnection conn = null;
    if (enabled) {
        if (!Lib.type.isInteger(port)) {
            Log.error(Geonet.GEONETWORK, "Proxy port is not an integer : "+ port);
        } else {
            if (!isProxyHostException(url.getHost(), ignoreHostList)) {

                InetSocketAddress sa = new InetSocketAddress(host, Integer.parseInt(port));
                Proxy proxy = new Proxy(Proxy.Type.HTTP, sa);
                conn = url.openConnection(proxy);

                if (username.trim().length() != 0) {
                    String encodedUserPwd = new Base64().encodeAsString((username + ":" + password).getBytes());
                    conn.setRequestProperty("Accept-Charset", "UTF-8");
                    conn.setRequestProperty("Proxy-Authorization", "Basic " + encodedUserPwd);
                }

            } else {
                conn = url.openConnection();
            }
        }
    } else {
        conn = url.openConnection();
    }

    return conn;
}

I'll commit the fix soon.

Regards,

Jose García

On Fri, Apr 15, 2016 at 9:15 AM, amacar <amadej.pevec@anonymised.com> wrote:

Problem was, that GetMap.java class is not using proxy settings.

We solved with this piece of code
(
https://github.com/geonetwork/core-geonetwork/blob/develop/services/src/main/java/org/fao/geonet/services/region/GetMap.java#L272
).

            Proxy proxy = null;

                        boolean useProxy =
settingManager.getValueAsBool(SettingManager.SYSTEM_PROXY_USE, false);
            if (useProxy) {
                String proxyHost =
settingManager.getValue(SettingManager.SYSTEM_PROXY_HOST);
                String proxyPort =
settingManager.getValue(SettingManager.SYSTEM_PROXY_PORT);
                //String username =
settingManager.getValue(SettingManager.SYSTEM_PROXY_USERNAME);
                //String password =
settingManager.getValue(SettingManager.SYSTEM_PROXY_PASSWORD);
                                proxy = new Proxy(Proxy.Type.HTTP, new
InetSocketAddress(proxyHost,
Integer.valueOf(proxyPort)));
            }

            InputStream in = null;
            try {
                URL imageUrl = new URL(background);
                in = useProxy ?
imageUrl.openConnection(proxy).getInputStream() : imageUrl.openStream();
                image = ImageIO.read(in);
            } catch (IOException e) {
                image = new BufferedImage(imageDimensions.width,
imageDimensions.height, BufferedImage.TYPE_INT_ARGB);
                error = e;
            }finally {
                if(in != null) {
                    IOUtils.closeQuietly(in);
                }

--
View this message in context:
http://osgeo-org.1560.x6.nabble.com/Spatial-extent-background-map-is-not-shown-tp5255116p5261372.html
Sent from the GeoNetwork users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications
Manager
Applications Manager provides deep performance insights into multiple
tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
GeoNetwork-users mailing list
GeoNetwork-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geonetwork-users
GeoNetwork OpenSource is maintained at
http://sourceforge.net/projects/geonetwork

--

*Vriendelijke groeten / Kind regards,Jose García
<http://www.geocat.net/&gt;Veenderweg 136721 WD BennekomThe NetherlandsT: +31
(0)318 416664 <+31318416664> <https://www.facebook.com/geocatbv&gt;
<https://twitter.com/geocat_bv&gt;
<https://plus.google.com/u/1/+GeocatNetbv/posts&gt;Please consider the
environment before printing this email.*

--

*Vriendelijke groeten / Kind regards,Jose García
<http://www.geocat.net/&gt;Veenderweg 136721 WD BennekomThe NetherlandsT: +31
(0)318 416664 <+31318416664> <https://www.facebook.com/geocatbv&gt;
<https://twitter.com/geocat_bv&gt;
<https://plus.google.com/u/1/+GeocatNetbv/posts&gt;Please consider the
environment before printing this email.*