[GeoNetwork-devel] How to use PostGIS spatial index in 3.0.0 Urgent

Hi everyone,

Sorry for reposting this, but I really can't figure it out since there is
little documentation of 3.0.

Currently, I am able to connect GNK with Postgre, but I want to use PostGIS
for my spatial index because I have a large volume of datasets. I have
already created postGIS extension in postgre DB, but I don't think PostGIS
is being used (C:\Program
Files\geonetwork\web\geonetwork\WEB-INF\data\index), because the spatial
index file keeps getting larger as I add more data. So, can someone save me?

Best,
Cody

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/How-to-use-PostGIS-spatial-index-in-3-0-0-Urgent-tp5208696.html
Sent from the GeoNetwork developer mailing list archive at Nabble.com.

Hi,

Did you try editing the postgres.xml file to change the driver to the postGIS one? Like on http://geonetwork-opensource.org/manuals/trunk/eng/users/admin/advanced-configuration/index.html#managing-the-database-connection-pool-through-apache-dbcp

Btw, for urgent things it is always good to have a support contract, even if it is an open source software :slight_smile: We are not always online and available.

Regards,
María.

···

On Tue, Jun 2, 2015 at 5:41 PM, yongyao <yjiang8@anonymised.com> wrote:

Hi everyone,

Sorry for reposting this, but I really can’t figure it out since there is
little documentation of 3.0.

Currently, I am able to connect GNK with Postgre, but I want to use PostGIS
for my spatial index because I have a large volume of datasets. I have
already created postGIS extension in postgre DB, but I don’t think PostGIS
is being used (C:\Program
Files\geonetwork\web\geonetwork\WEB-INF\data\index), because the spatial
index file keeps getting larger as I add more data. So, can someone save me?

Best,
Cody


View this message in context: http://osgeo-org.1560.x6.nabble.com/How-to-use-PostGIS-spatial-index-in-3-0-0-Urgent-tp5208696.html
Sent from the GeoNetwork developer mailing list archive at Nabble.com.



GeoNetwork-devel mailing list
GeoNetwork-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geonetwork-devel
GeoNetwork OpenSource is maintained at http://sourceforge.net/projects/geonetwork

Hi María,

Thanks for your prompt reply. Does GeoNetwork provide things like support
contract? If there is any, I will talk to my boss.

I tried to modify the postgres by using postgis driver, but the problem is
still there (GNK doesn't not use PostGIS for spatial index). Here is a
snippet from postgres.xml.

<bean id="jdbcDriverClassName" class="java.lang.String">
        <constructor-arg value="org.postgis.DriverWrapper"/>
</bean>

<bean id="jdbcURL" class="java.lang.String">
        <constructor-arg
value="jdbc:postgresql_postGIS://${jdbc.host}:5432/${jdbc.database}"/>
</bean>

And also, I tried to connect with PostGIS through JNDI, and I modified
jetty-env.xml (didn't touch jndi-postgres-postgis.xml), but I failed to
connect with DB.

Cody

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/How-to-use-PostGIS-spatial-index-in-3-0-0-Urgent-tp5208696p5208729.html
Sent from the GeoNetwork developer mailing list archive at Nabble.com.

On Tue, Jun 2, 2015 at 8:38 PM, yongyao <yjiang8@anonymised.com> wrote:

Hi María,

Thanks for your prompt reply. Does GeoNetwork provide things like support
contract? If there is any, I will talk to my boss.

GeoNetwork itself doesn't provide support. But there are many companies
around it that can help you with this. There is GeoCat (my company),
Titellus, Camp2Camp,...

I tried to modify the postgres by using postgis driver, but the problem is
still there (GNK doesn't not use PostGIS for spatial index). Here is a
snippet from postgres.xml.

<bean id="jdbcDriverClassName" class="java.lang.String">
        <constructor-arg value="org.postgis.DriverWrapper"/>
</bean>

<bean id="jdbcURL" class="java.lang.String">
        <constructor-arg
value="jdbc:postgresql_postGIS://${jdbc.host}:5432/${jdbc.database}"/>
</bean>

And with that configuration, the spatial index was still using the data
directory? Then maybe it is a bug.

And also, I tried to connect with PostGIS through JNDI, and I modified
jetty-env.xml (didn't touch jndi-postgres-postgis.xml), but I failed to
connect with DB.

Probably that configuration is no longer used. Now all database
configuration is done on the config-db folder.

Cody

--
View this message in context:
http://osgeo-org.1560.x6.nabble.com/How-to-use-PostGIS-spatial-index-in-3-0-0-Urgent-tp5208696p5208729.html
Sent from the GeoNetwork developer mailing list archive at Nabble.com.

------------------------------------------------------------------------------
_______________________________________________
GeoNetwork-devel mailing list
GeoNetwork-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geonetwork-devel
GeoNetwork OpenSource is maintained at
http://sourceforge.net/projects/geonetwork

Hi,

I think you need to import another file than postgres.xml in your srv.xml configuration file.
Try instead

<import resource=“…/config-db/postgis-alternate-datasource.xml”/>

···

On Wed, Jun 3, 2015 at 9:28 AM, María Arias de Reyna <delawen@anonymised.com> wrote:



GeoNetwork-devel mailing list
GeoNetwork-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geonetwork-devel
GeoNetwork OpenSource is maintained at http://sourceforge.net/projects/geonetwork

On Tue, Jun 2, 2015 at 8:38 PM, yongyao <yjiang8@anonymised.com> wrote:

Hi María,

Thanks for your prompt reply. Does GeoNetwork provide things like support
contract? If there is any, I will talk to my boss.

GeoNetwork itself doesn’t provide support. But there are many companies around it that can help you with this. There is GeoCat (my company), Titellus, Camp2Camp,…

I tried to modify the postgres by using postgis driver, but the problem is
still there (GNK doesn’t not use PostGIS for spatial index). Here is a
snippet from postgres.xml.

And with that configuration, the spatial index was still using the data directory? Then maybe it is a bug.

And also, I tried to connect with PostGIS through JNDI, and I modified
jetty-env.xml (didn’t touch jndi-postgres-postgis.xml), but I failed to
connect with DB.

Probably that configuration is no longer used. Now all database configuration is done on the config-db folder.

Cody


View this message in context: http://osgeo-org.1560.x6.nabble.com/How-to-use-PostGIS-spatial-index-in-3-0-0-Urgent-tp5208696p5208729.html

Sent from the GeoNetwork developer mailing list archive at Nabble.com.



GeoNetwork-devel mailing list
GeoNetwork-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geonetwork-devel
GeoNetwork OpenSource is maintained at http://sourceforge.net/projects/geonetwork

Florent Gravin
Camptocamp - Chambéry
0479444492

Thank you María and Gravin! Finally, I figured it out. Just wanna share the
solution in case someone else may have the same problem.

First, in order to connect with Postgres, we need to modify two files:
1. C:\Program
Files\geonetwork\web\geonetwork\WEB-INF\config-db\jdbc.properties
2. C:\Program Files\geonetwork\web\geonetwork\WEB-INF\config-node\srv.xml

Then, you should be able to connect with Postgres successfully

Second, when you have large dataset, you may want to use PostGIS spatial
index instead of built-in data directory. In order to do this, you have to
modify postgres.xml file under C:\Program
Files\geonetwork\web\geonetwork\WEB-INF\config-db\. Below is my snippet,

<import resource="defaultJdbcDataSource.xml" />
    <import resource="postgis-alternate-datasource.xml" />

    <bean id="jpaVendorAdapterDatabaseParam" class="java.lang.String">
        <constructor-arg value="POSTGRESQL"/>
    </bean>

    <bean id="jdbcDriverClassName" class="java.lang.String">
        <constructor-arg value="org.postgis.DriverWrapper"/>
    </bean>

    <bean id="jdbcURL" class="java.lang.String">
        <constructor-arg
value="jdbc:postgresql_postGIS://${jdbc.host}:5432/${jdbc.database}"/>

Lastly, for some reason, jdbc.properties missed "port" attribute which is
needed by postgis-alternate-datasource.xml. So you have to add it by
yourself.

Yongyao Jiang
Ph.D. Student in Earth Systems and GeoInformation Sciences
NSF Spatiotemporal Innovation Center http://stcenter.net
Department of Geography and GeoInformation Science
George Mason University
4400 University Drive, Fairfax, VA 22030​

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/How-to-use-PostGIS-spatial-index-in-3-0-0-Urgent-tp5208696p5208977.html
Sent from the GeoNetwork developer mailing list archive at Nabble.com.