الأربعاء، 8 أبريل 2020

Oracle Business Intelligence 11g installation guide (Linux)

GDAL/OGR with OCI support on Linux


This is a second post of the Maps series. It describes how to build a GDAL/OGR tool.
GDAL - Geospatial Data Abstraction Library
GDAL is a translator library for raster and vector geospatial data formats that is released under an X/MIT style Open Source licence by the Open Source Geospatial Foundation. As a library, it presents a single raster abstract data model and vector abstract data model to the calling application for all supported formats. It also comes with a variety of useful command line utilities for data translation and processing.
In a nutshell, GDAL/OGR is a library and a set of command line tools for manipulating geodata. It is used as a library in many products or can be used standalone for different purposes. I'm going to use ogr2ogr tool for importing Open Street Maps .pbf files into Oracle Spatial.
This tool is distributed in source codes and you need to build it before use. While this procedure is quite simple, I haven't found a complete guide for building it with OCI and PBF support on Linux platform.
At the time of writing this post, the current version is 2.0.2. You can get actual sources here
Download the source code.
Unpack it.
Change directory to the unpacked sources.
Run ./configure command.
Depending on your machine and which packages are installed you can get another result. I use freshly installed Oracle Linux 6 VM for this gude. You need to check these positions:

  • Expat support

  • OCI support

  • SQLite support
Expat and SQLite libraries can be easily installed with yum (or other package managers). We need to install both library and -devel packages.
Now ./configure should show that we have expat and SQLite libraries. But no OSI support yet.
For building GDAL/OGR with OCI support, we need to download and install Oracle Database Client. You need at least Runtime install type. Instant client is not enough.
Update: See info from John A Stevenson about using Oracle Instant Client below in the comments section.

Define ORACLE_HOME variable. If you don't do it, the compiler won't see your newly installed database client.
Run ./configure once again. You could see that all required options are "yes" for this time. If something of these three options is "no" you should resolve the issue before proceeding.
If everything is OK you may run make. It takes a few minutes to complete.
And the last step - make install (sudo make install).
Now your tools are located in the /usr/local/bin directory (you could change it with --prefix option of the configure commnad).
And configuration files are located in the /usr/local/share/gdal directory.
I'm going to use ogr2ogr program. A small test.
The file I'm going to use contains non-English characters, so I need to define NLS_LANG environment variable. It looks like the only important part is a character set (UTF8).
The basic syntax for ogr2org is the following:
org2ogr -f OCI OCI:username/password@tnsalias filename It looks like that only tnsalias is supported. I haven't managed to get work EZ-connect syntax.

This is the basic syntax, and it's likely that a big pbf file won't import with the default options
It's possible that we get some warnings. I see no impact of this warning on the result so simply ignore it.
Now we can open schema and see what was created. There are five tables for different types of data: LINESULTILINESTRINGSMULTYPOLYGONSOTHER_RELATIONS and POINTS.
We can preview data using Oracle Mapbuilder by now. It's OK that it look ugly. Later I'll show how to make it look good.
In the next post I'm going to show osmconf.ini file and some basic options for importing big data files.

Andrew Fomin Profile Picture
Andrew Fomin
OBIEE specialist since 2007 and Oracle Discoverer before. DWH architect, BI enthusiast, blogger. Lazy cats owner. All opinions are my own and not the views of my employer.


Additional Posts
Share This Post
   

1
Comments (5)
Closed discussion
M
> John A Stevenson2018.04.13 17:25
John A Stevenson
It is possible to build the GDAL/OGR OCI client without installing the Oracle Runtime. Just the Instant Client and more...
Hi John.

Thanks for the info.
2018.04.13 15:30
Ну что за люди пошли, толькo вчepа тyт былa ссылкa нa caйт на кoторoм мoжнo хoть нeмнoгo зарабoтaть, сeгодня eе yжe нет, удалили, зачeм так делaть?
2018.04.13 14:48
Message deleted
Этo пpоcтo капец какoй тo, ну пoлyчилоcь у Вac - отлично, зачем вeзде тpубить пpo это, дa eщe и ccылки на caйт публикoвать, yдалитe!
2018.04.13 14:47
Как так может пoлучатьcя, чтo одни нормaльно дeнегe зapaбaтывaют а тут вoт перeбиваeшьcя нa гpани беднoсти! Ведь ecть же возможности, тoлько где, кто можeт подcкaзать?
2018.04.13 14:39
It is possible to build the GDAL/OGR OCI client without installing the Oracle Runtime. Just the Instant Client and Instant Client SDK are required. The Dockerfile below shows how. It is based on https://github.com/GeographicaGS/Docker-GDAL2/tree/master/2.2.4, and includes a tip from GDAL-dev mailing list (https://lists.osgeo.org/pipermail/gdal-dev/2013-April/036097.html).

The tricky steps are to create symlinks for the libocci.so and libclntsh.so files and to register them with ldconfig.


```
##
# geographica/gdal2
#
# This creates an Ubuntu derived base image that installs GDAL 2.
#
# Ubuntu 16.04 Xenial Xerus
FROM ubuntu:xenial

MAINTAINER Cayetano Benavent < cayetano.benavent@geographica.gs >

ENV ROOTDIR /usr/local/
ENV GDAL_VERSION 2.2.4
ENV OPENJPEG_VERSION 2.2.0

# Load assets
WORKDIR $ROOTDIR/

# Install basic dependencies
RUN apt-get update -y && apt-get install -y \
software-properties-common \
python-software-properties \
python3-software-properties \
build-essential \
python-dev \
python3-dev \
python-numpy \
python3-numpy \
libspatialite-dev \
sqlite3 \
libaio1 \
libpq-dev \
libcurl4-gnutls-dev \
libproj-dev \
libxml2-dev \
libgeos-dev \
libnetcdf-dev \
libpoppler-dev \
libspatialite-dev \
libhdf4-alt-dev \
libhdf5-serial-dev \
wget \
bash-completion \
cmake \
unzip


# Download source code
#ADD http://download.osgeo.org/gdal/${GDAL_VERSION}/gdal-${GDAL_VERSION}.tar.gz $ROOTDIR/src/
#ADD https://github.com/uclouvain/openjpeg/archive/v${OPENJPEG_VERSION}.tar.gz $ROOTDIR/src/openjpeg-${OPENJPEG_VERSION}.tar.gz
COPY gdal-2.2.4.tar.gz $ROOTDIR/src/
COPY openjpeg-2.2.0.tar.gz $ROOTDIR/src/

# Compile and install OpenJPEG
RUN cd src && tar -xvf openjpeg-${OPENJPEG_VERSION}.tar.gz && cd openjpeg-${OPENJPEG_VERSION}/ \
&& mkdir build && cd build \
&& cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$ROOTDIR \
&& make && make install && make clean \
&& cd $ROOTDIR && rm -Rf src/openjpeg*

# Install the proprietary Oracle client libraries (see README.md for details)
ENV INSTANTCLIENT=instantclient-basic-linux.x64-12.2.0.1.0.zip
COPY $INSTANTCLIENT $ROOTDIR/src/
ENV INSTANTCLIENTSDK=instantclient-sdk-linux.x64-12.2.0.1.0.zip
COPY $INSTANTCLIENTSDK $ROOTDIR/src/

RUN cd src && unzip $INSTANTCLIENT && unzip $INSTANTCLIENTSDK \
&& cd instantclient_12_2 \
&& ln -s libocci.so.12.1 libocci.so \
&& ln -s libclntsh.so.12.1 libclntsh.so \
&& echo ${ROOTDIR}src/instantclient_12_2 > /etc/ld.so.conf.d/oracle_oci.conf \
&& ldconfig && cd $ROOTDIR

# Compile and install GDAL
RUN cd src && tar -xvf gdal-${GDAL_VERSION}.tar.gz && cd gdal-${GDAL_VERSION} \
&& ./configure --with-python --with-spatialite --with-pg --with-curl \
--with-openjpeg=$ROOTDIR \
--with-oci-include=/usr/local/src/instantclient_12_2/sdk/include \
--with-oci-lib=/usr/local/src/instantclient_12_2 \
&& make && make install && ldconfig \
&& apt-get update -y \
&& apt-get remove -y --purge build-essential wget \
&& cd $ROOTDIR && cd src/gdal-${GDAL_VERSION}/swig/python \
&& python3 setup.py build \
&& python3 setup.py install \
&& cd $ROOTDIR && rm -Rf src/gdal*

# Output version and capabilities by default.
CMD gdalinfo --version && gdalinfo --formats && ogrinfo --formats
```

ليست هناك تعليقات:

إرسال تعليق

ADF: Programmatic View Object Using Ref Cursor.

ADF: Programmatic View Object Using Ref Cursor. Posted by:  Manish Pandey   April 25, 2013   in  ADF   Leave a comment   3758 Views Sometime...