postgis/doc/po/templates/using_postgis_app.xml.pot

660 lines
22 KiB
Plaintext
Raw Normal View History

# SOME DESCRIPTIVE TITLE.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2012-09-14 17:50+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <kde-i18n-doc@kde.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#. Tag: title
#: using_postgis_app.xml:3
#, no-c-format
msgid "Using PostGIS Geometry: Building Applications"
msgstr ""
#. Tag: title
#: using_postgis_app.xml:5
#, no-c-format
msgid "Using MapServer"
msgstr ""
#. Tag: para
#: using_postgis_app.xml:7
#, no-c-format
msgid "The Minnesota MapServer is an internet web-mapping server which conforms to the OpenGIS Web Mapping Server specification."
msgstr ""
#. Tag: para
#: using_postgis_app.xml:12
#, no-c-format
msgid "The MapServer homepage is at <ulink url=\"http://mapserver.org\">http://mapserver.org</ulink>."
msgstr ""
#. Tag: para
#: using_postgis_app.xml:17
#, no-c-format
msgid "The OpenGIS Web Map Specification is at <ulink url=\"http://www.opengeospatial.org/standards/wms\">http://www.opengeospatial.org/standards/wms</ulink>."
msgstr ""
#. Tag: title
#: using_postgis_app.xml:23
#, no-c-format
msgid "Basic Usage"
msgstr ""
#. Tag: para
#: using_postgis_app.xml:25
#, no-c-format
msgid "To use PostGIS with MapServer, you will need to know about how to configure MapServer, which is beyond the scope of this documentation. This section will cover specific PostGIS issues and configuration details."
msgstr ""
#. Tag: para
#: using_postgis_app.xml:30
#, no-c-format
msgid "To use PostGIS with MapServer, you will need:"
msgstr ""
#. Tag: para
#: using_postgis_app.xml:34
#, no-c-format
msgid "Version 0.6 or newer of PostGIS."
msgstr ""
#. Tag: para
#: using_postgis_app.xml:38
#, no-c-format
msgid "Version 3.5 or newer of MapServer."
msgstr ""
#. Tag: para
#: using_postgis_app.xml:42
#, no-c-format
msgid "MapServer accesses PostGIS/PostgreSQL data like any other PostgreSQL client -- using the <filename>libpq</filename> interface. This means that MapServer can be installed on any machine with network access to the PostGIS server, and use PostGIS as a source of data. The faster the connection between the systems, the better."
msgstr ""
#. Tag: para
#: using_postgis_app.xml:50
#, no-c-format
msgid "Compile and install MapServer, with whatever options you desire, including the \"--with-postgis\" configuration option."
msgstr ""
#. Tag: para
#: using_postgis_app.xml:55
#, no-c-format
msgid "In your MapServer map file, add a PostGIS layer. For example:"
msgstr ""
#. Tag: programlisting
#: using_postgis_app.xml:58
#, no-c-format
msgid ""
"LAYER \n"
" CONNECTIONTYPE postgis \n"
" NAME \"widehighways\" \n"
" # Connect to a remote spatial database\n"
" CONNECTION \"user=dbuser dbname=gisdatabase host=bigserver\"\n"
" PROCESSING \"CLOSE_CONNECTION=DEFER\"\n"
" # Get the lines from the 'geom' column of the 'roads' table \n"
" DATA \"geom from roads using srid=4326 using unique gid\" \n"
" STATUS ON\n"
" TYPE LINE \n"
" # Of the lines in the extents, only render the wide highways \n"
" FILTER \"type = 'highway' and numlanes &gt;= 4\" \n"
" CLASS \n"
" # Make the superhighways brighter and 2 pixels wide\n"
" EXPRESSION ([numlanes] &gt;= 6) \n"
" STYLE\n"
" COLOR 255 22 22 \n"
" WIDTH 2 \n"
" END\n"
" END \n"
" CLASS \n"
" # All the rest are darker and only 1 pixel wide \n"
" EXPRESSION ([numlanes] &lt; 6) \n"
" STYLE\n"
" COLOR 205 92 82\n"
" END\n"
" END \n"
"END"
msgstr ""
#. Tag: para
#: using_postgis_app.xml:60
#, no-c-format
msgid "In the example above, the PostGIS-specific directives are as follows:"
msgstr ""
#. Tag: term
#: using_postgis_app.xml:65
#, no-c-format
msgid "CONNECTIONTYPE"
msgstr ""
#. Tag: para
#: using_postgis_app.xml:68
#, no-c-format
msgid "For PostGIS layers, this is always \"postgis\"."
msgstr ""
#. Tag: term
#: using_postgis_app.xml:73
#, no-c-format
msgid "CONNECTION"
msgstr ""
#. Tag: para
#: using_postgis_app.xml:76
#, no-c-format
msgid "The database connection is governed by the a 'connection string' which is a standard set of keys and values like this (with the default values in &lt;&gt;):"
msgstr ""
#. Tag: para
#: using_postgis_app.xml:80
#, no-c-format
msgid "user=&lt;username&gt; password=&lt;password&gt; dbname=&lt;username&gt; hostname=&lt;server&gt; port=&lt;5432&gt;"
msgstr ""
#. Tag: para
#: using_postgis_app.xml:84
#, no-c-format
msgid "An empty connection string is still valid, and any of the key/value pairs can be omitted. At a minimum you will generally supply the database name and username to connect with."
msgstr ""
#. Tag: term
#: using_postgis_app.xml:92
#, no-c-format
msgid "DATA"
msgstr ""
#. Tag: para
#: using_postgis_app.xml:95
#, no-c-format
msgid "The form of this parameter is \"&lt;geocolumn&gt; from &lt;tablename&gt; using srid=&lt;srid&gt; using unique &lt;primary key&gt;\" where the column is the spatial column to be rendered to the map, the SRID is SRID used by the column and the primary key is the table primary key (or any other uniquely-valued column with an index)."
msgstr ""
#. Tag: para
#: using_postgis_app.xml:99
#, no-c-format
msgid "You can omit the \"using srid\" and \"using unique\" clauses and MapServer will automatically determine the correct values if possible, but at the cost of running a few extra queries on the server for each map draw."
msgstr ""
#. Tag: term
#: using_postgis_app.xml:106
#, no-c-format
msgid "PROCESSING"
msgstr ""
#. Tag: para
#: using_postgis_app.xml:109
#, no-c-format
msgid "Putting in a CLOSE_CONNECTION=DEFER if you have multiple layers reuses existing connections instead of closing them. This improves speed. Refer to for <ulink url=\"http://blog.cleverelephant.ca/2008/10/mapserverpostgis-performance-tips.html\">MapServer PostGIS Performance Tips</ulink> for a more detailed explanation."
msgstr ""
#. Tag: term
#: using_postgis_app.xml:115
#, no-c-format
msgid "FILTER"
msgstr ""
#. Tag: para
#: using_postgis_app.xml:118
#, no-c-format
msgid "The filter must be a valid SQL string corresponding to the logic normally following the \"WHERE\" keyword in a SQL query. So, for example, to render only roads with 6 or more lanes, use a filter of \"num_lanes &gt;= 6\"."
msgstr ""
#. Tag: para
#: using_postgis_app.xml:128
#, no-c-format
msgid "In your spatial database, ensure you have spatial (GiST) indexes built for any the layers you will be drawing."
msgstr ""
#. Tag: programlisting
#: using_postgis_app.xml:131
#, no-c-format
msgid "CREATE INDEX [indexname] ON [tablename] USING GIST ( [geometrycolumn] );"
msgstr ""
#. Tag: para
#: using_postgis_app.xml:135
#, no-c-format
msgid "If you will be querying your layers using MapServer you will also need to use the \"using unique\" clause in your DATA statement."
msgstr ""
#. Tag: para
#: using_postgis_app.xml:138
#, no-c-format
msgid "MapServer requires unique identifiers for each spatial record when doing queries, and the PostGIS module of MapServer uses the unique value you specify in order to provide these unique identifiers. Using the table primary key is the best practice."
msgstr ""
#. Tag: title
#: using_postgis_app.xml:147
#, no-c-format
msgid "Frequently Asked Questions"
msgstr ""
#. Tag: para
#: using_postgis_app.xml:152
#, no-c-format
msgid "When I use an <varname>EXPRESSION</varname> in my map file, the condition never returns as true, even though I know the values exist in my table."
msgstr ""
#. Tag: para
#: using_postgis_app.xml:158
#, no-c-format
msgid "Unlike shape files, PostGIS field names have to be referenced in EXPRESSIONS using <emphasis>lower case</emphasis>."
msgstr ""
#. Tag: programlisting
#: using_postgis_app.xml:162
#, no-c-format
msgid "EXPRESSION ([numlanes] &gt;= 6)"
msgstr ""
#. Tag: para
#: using_postgis_app.xml:168
#, no-c-format
msgid "The FILTER I use for my Shape files is not working for my PostGIS table of the same data."
msgstr ""
#. Tag: para
#: using_postgis_app.xml:173
#, no-c-format
msgid "Unlike shape files, filters for PostGIS layers use SQL syntax (they are appended to the SQL statement the PostGIS connector generates for drawing layers in MapServer)."
msgstr ""
#. Tag: programlisting
#: using_postgis_app.xml:177
#, no-c-format
msgid "FILTER \"type = 'highway' and numlanes &gt;= 4\""
msgstr ""
#. Tag: para
#: using_postgis_app.xml:183
#, no-c-format
msgid "My PostGIS layer draws much slower than my Shape file layer, is this normal?"
msgstr ""
#. Tag: para
#: using_postgis_app.xml:188
#, no-c-format
msgid "In general, the more features you are drawing into a given map, the more likely it is that PostGIS will be slower than Shape files. For maps with relatively few features (100s), PostGIS will often be faster. For maps with high feature density (1000s), PostGIS will always be slower."
msgstr ""
#. Tag: para
#: using_postgis_app.xml:194
#, no-c-format
msgid "If you are finding substantial draw performance problems, it is possible that you have not built a spatial index on your table."
msgstr ""
#. Tag: programlisting
#: using_postgis_app.xml:198
#, no-c-format
msgid ""
"postgis# CREATE INDEX geotable_gix ON geotable USING GIST ( geocolumn ); \n"
"postgis# VACUUM ANALYZE;"
msgstr ""
#. Tag: para
#: using_postgis_app.xml:204
#, no-c-format
msgid "My PostGIS layer draws fine, but queries are really slow. What is wrong?"
msgstr ""
#. Tag: para
#: using_postgis_app.xml:209
#, no-c-format
msgid "For queries to be fast, you must have a unique key for your spatial table and you must have an index on that unique key."
msgstr ""
#. Tag: para
#: using_postgis_app.xml:213
#, no-c-format
msgid "You can specify what unique key for mapserver to use with the <varname>USING UNIQUE</varname> clause in your <varname>DATA</varname> line:"
msgstr ""
#. Tag: programlisting
#: using_postgis_app.xml:217
#, no-c-format
msgid "DATA \"geom FROM geotable USING UNIQUE gid\""
msgstr ""
#. Tag: para
#: using_postgis_app.xml:224
#, no-c-format
msgid "Can I use \"geography\" columns (new in PostGIS 1.5) as a source for MapServer layers?"
msgstr ""
#. Tag: para
#: using_postgis_app.xml:229
#, no-c-format
msgid "Yes! MapServer understands geography columns as being the same as geometry columns, but always using an SRID of 4326. Just make sure to include a \"using srid=4326\" clause in your <varname>DATA</varname> statement. Everything else works exactly the same as with geometry."
msgstr ""
#. Tag: programlisting
#: using_postgis_app.xml:234
#, no-c-format
msgid "DATA \"geog FROM geogtable USING SRID=4326 USING UNIQUE gid\""
msgstr ""
#. Tag: title
#: using_postgis_app.xml:244
#, no-c-format
msgid "Advanced Usage"
msgstr ""
#. Tag: para
#: using_postgis_app.xml:246
#, no-c-format
msgid "The <varname>USING</varname> pseudo-SQL clause is used to add some information to help mapserver understand the results of more complex queries. More specifically, when either a view or a subselect is used as the source table (the thing to the right of \"FROM\" in a <varname>DATA</varname> definition) it is more difficult for mapserver to automatically determine a unique identifier for each row and also the SRID for the table. The <varname>USING</varname> clause can provide mapserver with these two pieces of information as follows:"
msgstr ""
#. Tag: programlisting
#: using_postgis_app.xml:255
#, no-c-format
msgid ""
"DATA \"geom FROM (\n"
" SELECT \n"
" table1.geom AS geom, \n"
" table1.gid AS gid, \n"
" table2.data AS data \n"
" FROM table1 \n"
" LEFT JOIN table2 \n"
" ON table1.id = table2.id\n"
") AS new_table USING UNIQUE gid USING SRID=4326\""
msgstr ""
#. Tag: term
#: using_postgis_app.xml:259
#, no-c-format
msgid "USING UNIQUE &lt;uniqueid&gt;"
msgstr ""
#. Tag: para
#: using_postgis_app.xml:262
#, no-c-format
msgid "MapServer requires a unique id for each row in order to identify the row when doing map queries. Normally it identifies the primary key from the system tables. However, views and subselects don't automatically have an known unique column. If you want to use MapServer's query functionality, you need to ensure your view or subselect includes a uniquely valued column, and declare it with <varname>USING UNIQUE</varname>. For example, you could explicitly select nee of the table's primary key values for this purpose, or any other column which is guaranteed to be unique for the result set."
msgstr ""
#. Tag: para
#: using_postgis_app.xml:273
#, no-c-format
msgid "\"Querying a Map\" is the action of clicking on a map to ask for information about the map features in that location. Don't confuse \"map queries\" with the SQL query in a <varname>DATA</varname> definition."
msgstr ""
#. Tag: term
#: using_postgis_app.xml:282
#, no-c-format
msgid "USING SRID=&lt;srid&gt;"
msgstr ""
#. Tag: para
#: using_postgis_app.xml:285
#, no-c-format
msgid "PostGIS needs to know which spatial referencing system is being used by the geometries in order to return the correct data back to MapServer. Normally it is possible to find this information in the \"geometry_columns\" table in the PostGIS database, however, this is not possible for tables which are created on the fly such as subselects and views. So the <varname>USING SRID=</varname> option allows the correct SRID to be specified in the <varname>DATA</varname> definition."
msgstr ""
#. Tag: title
#: using_postgis_app.xml:300
#, no-c-format
msgid "Examples"
msgstr ""
#. Tag: para
#: using_postgis_app.xml:302
#, no-c-format
msgid "Lets start with a simple example and work our way up. Consider the following MapServer layer definition:"
msgstr ""
#. Tag: programlisting
#: using_postgis_app.xml:305
#, no-c-format
msgid ""
"LAYER \n"
" CONNECTIONTYPE postgis \n"
" NAME \"roads\"\n"
" CONNECTION \"user=theuser password=thepass dbname=thedb host=theserver\" \n"
" DATA \"geom from roads\" \n"
" STATUS ON \n"
" TYPE LINE \n"
" CLASS \n"
" STYLE\n"
" COLOR 0 0 0 \n"
" END\n"
" END \n"
"END"
msgstr ""
#. Tag: para
#: using_postgis_app.xml:307
#, no-c-format
msgid "This layer will display all the road geometries in the roads table as black lines."
msgstr ""
#. Tag: para
#: using_postgis_app.xml:310
#, no-c-format
msgid "Now lets say we want to show only the highways until we get zoomed in to at least a 1:100000 scale - the next two layers will achieve this effect:"
msgstr ""
#. Tag: programlisting
#: using_postgis_app.xml:314
#, no-c-format
msgid ""
"LAYER \n"
" CONNECTIONTYPE postgis \n"
" CONNECTION \"user=theuser password=thepass dbname=thedb host=theserver\" \n"
" PROCESSING \"CLOSE_CONNECTION=DEFER\"\n"
" DATA \"geom from roads\"\n"
" MINSCALE 100000 \n"
" STATUS ON \n"
" TYPE LINE \n"
" FILTER \"road_type = 'highway'\" \n"
" CLASS \n"
" COLOR 0 0 0 \n"
" END \n"
"END \n"
"LAYER \n"
" CONNECTIONTYPE postgis \n"
" CONNECTION \"user=theuser password=thepass dbname=thedb host=theserver\"\n"
" PROCESSING \"CLOSE_CONNECTION=DEFER\"\n"
" DATA \"geom from roads\" \n"
" MAXSCALE 100000 \n"
" STATUS ON \n"
" TYPE LINE\n"
" CLASSITEM road_type \n"
" CLASS \n"
" EXPRESSION \"highway\" \n"
" STYLE\n"
" WIDTH 2 \n"
" COLOR 255 0 0 \n"
" END\n"
" END \n"
" CLASS \n"
" STYLE\n"
" COLOR 0 0 0 \n"
" END\n"
" END \n"
"END"
msgstr ""
#. Tag: para
#: using_postgis_app.xml:316
#, no-c-format
msgid "The first layer is used when the scale is greater than 1:100000, and displays only the roads of type \"highway\" as black lines. The <varname>FILTER</varname> option causes only roads of type \"highway\" to be displayed."
msgstr ""
#. Tag: para
#: using_postgis_app.xml:321
#, no-c-format
msgid "The second layer is used when the scale is less than 1:100000, and will display highways as double-thick red lines, and other roads as regular black lines."
msgstr ""
#. Tag: para
#: using_postgis_app.xml:325
#, no-c-format
msgid "So, we have done a couple of interesting things using only MapServer functionality, but our <varname>DATA</varname> SQL statement has remained simple. Suppose that the name of the road is stored in another table (for whatever reason) and we need to do a join to get it and label our roads."
msgstr ""
#. Tag: programlisting
#: using_postgis_app.xml:331
#, no-c-format
msgid ""
"LAYER \n"
" CONNECTIONTYPE postgis\n"
" CONNECTION \"user=theuser password=thepass dbname=thedb host=theserver\" \n"
" DATA \"geom FROM (SELECT roads.gid AS gid, roads.geom AS geom, \n"
" road_names.name as name FROM roads LEFT JOIN road_names ON \n"
" roads.road_name_id = road_names.road_name_id) \n"
" AS named_roads USING UNIQUE gid USING SRID=4326\" \n"
" MAXSCALE 20000 \n"
" STATUS ON \n"
" TYPE ANNOTATION \n"
" LABELITEM name\n"
" CLASS \n"
" LABEL \n"
" ANGLE auto \n"
" SIZE 8 \n"
" COLOR 0 192 0 \n"
" TYPE truetype \n"
" FONT arial\n"
" END\n"
" END \n"
"END"
msgstr ""
#. Tag: para
#: using_postgis_app.xml:333
#, no-c-format
msgid "This annotation layer adds green labels to all the roads when the scale gets down to 1:20000 or less. It also demonstrates how to use an SQL join in a <varname>DATA</varname> definition."
msgstr ""
#. Tag: title
#: using_postgis_app.xml:340
#, no-c-format
msgid "Java Clients (JDBC)"
msgstr ""
#. Tag: para
#: using_postgis_app.xml:342
#, no-c-format
msgid "Java clients can access PostGIS \"geometry\" objects in the PostgreSQL database either directly as text representations or using the JDBC extension objects bundled with PostGIS. In order to use the extension objects, the \"postgis.jar\" file must be in your CLASSPATH along with the \"postgresql.jar\" JDBC driver package."
msgstr ""
#. Tag: programlisting
#: using_postgis_app.xml:348
#, no-c-format
msgid ""
"import java.sql.*; \n"
"import java.util.*; \n"
"import java.lang.*; \n"
"import org.postgis.*; \n"
"\n"
"public class JavaGIS { \n"
"\n"
"public static void main(String[] args) { \n"
"\n"
" java.sql.Connection conn; \n"
"\n"
" try { \n"
" /* \n"
" * Load the JDBC driver and establish a connection. \n"
" */\n"
" Class.forName(\"org.postgresql.Driver\"); \n"
" String url = \"jdbc:postgresql://localhost:5432/database\"; \n"
" conn = DriverManager.getConnection(url, \"postgres\", \"\"); \n"
" /* \n"
" * Add the geometry types to the connection. Note that you \n"
" * must cast the connection to the pgsql-specific connection \n"
" * implementation before calling the addDataType() method. \n"
" */\n"
" ((org.postgresql.PGConnection)conn).addDataType(\"geometry\",Class.forName(\"org.postgis.PGgeometry\"));\n"
" ((org.postgresql.PGConnection)conn).addDataType(\"box3d\",Class.forName(\"org.postgis.PGbox3d\"));\n"
" /* \n"
" * Create a statement and execute a select query. \n"
" */ \n"
" Statement s = conn.createStatement(); \n"
" ResultSet r = s.executeQuery(\"select geom,id from geomtable\"); \n"
" while( r.next() ) { \n"
" /* \n"
" * Retrieve the geometry as an object then cast it to the geometry type. \n"
" * Print things out. \n"
" */ \n"
" PGgeometry geom = (PGgeometry)r.getObject(1); \n"
" int id = r.getInt(2); \n"
" System.out.println(\"Row \" + id + \":\");\n"
" System.out.println(geom.toString()); \n"
" } \n"
" s.close(); \n"
" conn.close(); \n"
" } \n"
"catch( Exception e ) { \n"
" e.printStackTrace(); \n"
" } \n"
"} \n"
"}"
msgstr ""
#. Tag: para
#: using_postgis_app.xml:350
#, no-c-format
msgid "The \"PGgeometry\" object is a wrapper object which contains a specific topological geometry object (subclasses of the abstract class \"Geometry\") depending on the type: Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon."
msgstr ""
#. Tag: programlisting
#: using_postgis_app.xml:355
#, no-c-format
msgid ""
"PGgeometry geom = (PGgeometry)r.getObject(1); \n"
"if( geom.getType() == Geometry.POLYGON ) { \n"
" Polygon pl = (Polygon)geom.getGeometry(); \n"
" for( int r = 0; r &lt; pl.numRings(); r++) { \n"
" LinearRing rng = pl.getRing(r); \n"
" System.out.println(\"Ring: \" + r); \n"
" for( int p = 0; p &lt; rng.numPoints(); p++ ) { \n"
" Point pt = rng.getPoint(p); \n"
" System.out.println(\"Point: \" + p);\n"
" System.out.println(pt.toString()); \n"
" } \n"
" } \n"
"}"
msgstr ""
#. Tag: para
#: using_postgis_app.xml:357
#, no-c-format
msgid "The JavaDoc for the extension objects provides a reference for the various data accessor functions in the geometric objects."
msgstr ""
#. Tag: title
#: using_postgis_app.xml:362
#, no-c-format
msgid "C Clients (libpq)"
msgstr ""
#. Tag: para
#: using_postgis_app.xml:364 using_postgis_app.xml:369 using_postgis_app.xml:375
#, no-c-format
msgid "<para>...</para>"
msgstr ""
#. Tag: title
#: using_postgis_app.xml:367
#, no-c-format
msgid "Text Cursors"
msgstr ""
#. Tag: title
#: using_postgis_app.xml:373
#, no-c-format
msgid "Binary Cursors"
msgstr ""