CINXE.COM
PostGIS | Ebean ORM
<!doctype html> <html lang="en"> <head> <title>PostGIS | Ebean ORM</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <link rel="shortcut icon" href="/images/favicon.ico"> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto|Source+Sans+Pro|Ubuntu&display=swap"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.1.0/css/all.css" integrity="sha384-lKuwvrZot6UHsBSfcMvOkWwlCMgc0TaWr+30HWe3a4ltaBwTZhyTEggF5tJv8tbt" crossorigin="anonymous"> <link rel="stylesheet" href="/css/reset3.css"> <link rel="stylesheet" href="/css/site3.css"> <link rel="stylesheet" href="/css/pygments3.css"> </head> <body> <div id="main"> <div id="banner"> <header> <nav id="top"> <h1 id="breadcrumb"> <a class="nav-logo" href="/"><img src="/images/logo-200.png" height="35"></a> <a href="/docs">Documentation</a><span class="sep"> / </span><a href="/docs/database">Database platforms</a><span class="sep"> / </span><a href="/docs/database/postgres">Postgres</a><span class="sep"> / </span><span class="last">PostGIS</span> </h1> <ul> <li><a onclick="toggleTheme();" title="switch dark light theme"><i class="fas fa-adjust"></i></a></li> </ul> </nav> </header> </div> <div class="grid grid-docs"> <aside> <nav class="side"> <ul> <li class="nav0 "> <a href="/docs/getting-started">Getting started</a> </li> <li class="nav0 "> <a href="/docs/intro">Introduction</a> </li> <li class="nav0 active"> <a class="active" href="/docs">Documentation</a> <ul> <li class="nav1 "> <a href="/docs/best-practice">Best practice</a> </li> <li class="nav1 "> <a href="/docs/query">Query</a> </li> <li class="nav1 "> <a href="/docs/persist">Persist</a> </li> <li class="nav1 "> <a href="/docs/transactions">Transactions</a> </li> <li class="nav1 "> <a href="/docs/mapping">Mapping</a> </li> <li class="nav1 "> <a href="/docs/ddl-generation">DDL & Migrations</a> </li> <li class="nav1 "> <a href="/docs/logging">Logging</a> </li> <li class="nav1 "> <a href="/docs/testing">Testing</a> </li> <li class="nav1 "> <a href="/docs/read-replicas">Read Replicas</a> </li> <li class="nav1 active"> <a class="active" href="/docs/database">Database platforms</a> <ul class="nav"> <li class="active"> <a class="active" href="/docs/database/postgres">Postgres</a> </li> <li > <a href="/docs/database/h2">H2</a> </li> <li > <a href="/docs/database/mysql">MySql</a> </li> <li > <a href="/docs/database/mariadb">MariaDB</a> </li> <li > <a href="/docs/database/sqlserver">SQL Server</a> </li> <li > <a href="/docs/database/oracle">Oracle</a> </li> <li > <a href="/docs/database/db2">DB2</a> </li> <li > <a href="/docs/database/hana">SAP Hana</a> </li> <li > <a href="/docs/database/sqlite">Sqlite</a> </li> <li > <a href="/docs/database/clickhouse">ClickHouse</a> </li> <li > <a href="/docs/database/cockroach">Cockroach</a> </li> <li > <a href="/docs/database/yugabyte">YugabyteDB</a> </li> <li > <a href="/docs/database/nuodb">NuoDB</a> </li> <li > <a href="/docs/database/elasticsearch">ElasticSearch</a> </li> <li > <a href="/docs/database/redis">Redis</a> </li> </ul> </li> <li class="nav1 "> <a href="/docs/multi-database">Multiple databases</a> </li> <li class="nav1 "> <a href="/docs/kotlin">Kotlin</a> </li> <li><a href="/docs/tuning">Tuning</a></li> <li class="nav1 "> <a href="/docs/features">Features</a> </li> </ul> </li> <li class="nav0 "> <a href="/support">Getting help</a> </li> <li class="nav0 "> <a target="_blank" href="/apidoc/13">API Javadoc</a> </li> <li class="nav0 "> <a href="/videos">Videos</a> </li> <li class="nav0 "> <a href="/docs/upgrading">Upgrading</a> </li> <li class="nav0 "> <a href="/releases">Releases</a> </li> </ul> </nav> </aside> <article> <form action="https://www.google.com/search" method="get" class="inline-form"> <input type="hidden" name="as_sitesearch" value="ebean.io"> <div id="page-search"> <div class="input-group"> <input class="frm" name="q" id="searchinput" type="text" placeholder="Search... (press 's' to focus)" data-placeholder-focus="Search... (use '↑', '↓' and '⏎' to select results)" data-placeholder-blur="Search... (press 's' to focus)" autocomplete="off"> <div class="input-group-btn"> <button class="frm" type="submit"><i class="fas fa-search"></i></button> </div> </div> <div id="page-search-results" style="display: none;"> <ul id="search-results-container" class="search-results"><li class=" active"><a href="/docs" title="Docs"><span style="color:#777;">Docs</span> Documentation </a></li><li class=""><small style="color:#999;">And 101 more...</small></li></ul> </div> </div> </form> <h2 id="postgis">PostGIS</h2> <p> Below is a test setup using the <code>mdillon/postgis</code> docker container that has PostGIS extension installed. </p> <p> This will automatically download and run the container making live a little easier. Note the use of the Postgis specfic driver and url. </p> <div class="syntax yml"><div class="highlight"><pre><span></span><span class="nt">ebean</span><span class="p">:</span> <span class="nt">geometrySRID</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">4674</span> <span class="c1"># If we don't want the default geometrySRID of 4326</span> <span class="nt">test</span><span class="p">:</span> <span class="nt">shutdown</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">none</span> <span class="c1"># stop | remove | none</span> <span class="nt">platform</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">postgis</span> <span class="nt">ddlMode</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">dropCreate</span> <span class="c1"># none | dropCreate | migrations | create</span> <span class="nt">dbName</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">my_gisapp</span> </pre></div> </div> <p> The above <code>postgis</code> platform is equivalent to the setup below which uses: </p> <table class="compact w100"> <tr><th>username:</th><td>{databaseName}</td></tr> <tr><th>password:</th><td>test</td></tr> <tr><th>port:</th><td>7432</td></tr> <tr><th>url:</th><td>jdbc:postgresql_lwgis://localhost:{port}/{databaseName}</td></tr> <tr><th>driver:</th><td>org.postgis.DriverWrapperLW</td></tr> <tr><th>image:</th><td>mdillon/postgis:{version}</td></tr> </table> <div class="syntax yml"><div class="highlight"><pre><span></span><span class="nt">ebean</span><span class="p">:</span> <span class="nt">geometrySRID</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">4674</span> <span class="nt">test</span><span class="p">:</span> <span class="nt">shutdown</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">none</span> <span class="c1"># stop | remove | none</span> <span class="nt">platform</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">postgres</span> <span class="nt">ddlMode</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">dropCreate</span> <span class="c1"># none | dropCreate | migrations | create</span> <span class="nt">dbName</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">my_gisapp</span> <span class="nt">postgres</span><span class="p">:</span> <span class="nt">containerName</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">postgis</span> <span class="nt">image</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">mdillon/postgis</span> <span class="nt">extensions</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">postgis</span> <span class="nt">url</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">jdbc:postgresql_lwgis://127.0.0.1:7432/my_gisapp</span> <span class="nt">driver</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">org.postgis.DriverWrapperLW</span> </pre></div> </div> <nav class="next"> <p class="edit-page"> <a href="https://github.com/ebean-orm/website-source/blob/master/docs/database/postgres/postgis.html"><i class="fab fa-github"></i> Edit Page</a> </p> <p class="next"> <a href="/docs/database/mysql" class="btn btn-info">Next: MySql</a> </p> </nav> </article> </div> </div> <script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script> <script src="/js/site3.js"></script> <script src="/js/search3.js"></script> <script async src="https://www.googletagmanager.com/gtag/js?id=UA-75181644-1"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-75181644-1'); </script> </body> </html>