140 | | 1. Follow the [http://postgis.refractions.net/documentation/manual-1.3/ch02.html instructions to compile PostGIS]. |
141 | | |
142 | | 2. Get the PostGIS Raster source code. You have two options: |
143 | | |
144 | | * Download the latest development snapshot from http://postgis.refractions.net/download/ |
145 | | |
146 | | * Using a SVN client, retrieve the very last PostGIS Raster source from http://svn.osgeo.org/postgis/spike/wktraster. In this case you will have to generate the "configure" script with autogen: |
147 | | |
148 | | {{{ |
149 | | >./autogen.sh |
150 | | }}} |
151 | | |
152 | | 3. From the wktraster directory, run: |
153 | | |
154 | | {{{ |
155 | | >./configure --with-postgis-sources=/thesrc/postgis-version |
156 | | }}} |
157 | | |
158 | | |
159 | | 4. Run the compile and install commands: |
160 | | |
161 | | |
162 | | {{{ |
163 | | >make & make install |
164 | | }}} |
165 | | |
166 | | |
167 | | PostgreSQL provides a utility called pg_config to enable extensions like PostGIS to locate the PostgreSQL installation directory. If ./configure didn't find pg_config, try using the --with-pgconfig=/path/to/pg_config switch to specify a particular PostgreSQL installation. |
168 | | |
169 | | |
170 | | '''2.3.2 - Compiling on Windows using MSYS/MinGW''' |
171 | | |
172 | | 1. Compile PostGIS [wiki:UsersWikiWinCompile using these instructions]. |
173 | | |
174 | | 2. Get GDAL 1.7.1 sources from [http://trac.osgeo.org/gdal/wiki/DownloadSource] and extract (you need this for advanced features like ST_DumpAsPolygons). |
175 | | |
176 | | 3. Configure the GDAL build without libtool. (Refer to [http://trac.osgeo.org/gdal/ticket/3465].) |
177 | | |
178 | | {{{ |
179 | | >cd /c/projects/GDAL/gdal-1.7.1 |
180 | | >./configure --without-libtool --with-libtiff=internal --with-libz=/c/gtk/include |
181 | | }}} |
182 | | |
183 | | 4. Edit /c/thesrc/gdal/gdal-1.7.1/GNUMakefile so that GDAL_OBJ, at the beginning of the file, is assigned like this: |
184 | | |
185 | | {{{ |
186 | | GDAL_OBJ = ./frmts/o/*.o \ |
187 | | ./gcore/*.o \ |
188 | | ./port/*.o \ |
189 | | ./alg/*.o |
190 | | }}} |
191 | | |
192 | | 5. Build and install GDAL. |
193 | | |
194 | | {{{ |
195 | | >make clean && make |
196 | | >make install |
197 | | }}} |
198 | | |
199 | | libgdal.dll should now exist in /usr/local/lib |
200 | | |
201 | | 6. You can remove the debug information from libgdal.dll: |
202 | | |
203 | | {{{ |
204 | | >strip /usr/local/lib/libgdal.dll |
205 | | }}} |
206 | | |
207 | | |
208 | | 7. Get the PostGIS Raster source code. You have two options: |
209 | | |
210 | | * Download the latest development snapshot from http://postgis.refractions.net/download/ |
211 | | |
212 | | * Using a SVN client, retrieve the very last PostGIS Raster source from http://svn.osgeo.org/postgis/spike/wktraster. In this case you will have to generate the "configure" script with autogen: |
213 | | |
214 | | {{{ |
215 | | >./autogen.sh |
216 | | }}} |
217 | | |
218 | | 8. CD to the wktraster folder and configure (if you don't want to build with GDAL leave out the --enable-development line). |
219 | | |
220 | | {{{ |
221 | | >cd /c/thesrc/wktraster-svn |
222 | | >./configure \ |
223 | | --prefix=/c/postgres --with-postgis-sources=/c/thesrc/postgis-version --with-pgconfig=/c/postgres/bin/pg_config |
224 | | }}} |
225 | | |
226 | | 9. Run the compile and install commands: |
227 | | |
228 | | {{{ |
229 | | >make & make install |
230 | | }}} |
231 | | |
232 | | '''Troubleshouting''' |
233 | | |
234 | | * If make tries to compile using "cc" and can't find it (you get "cc: Command not found"). Try copying gcc to cc in MinGW/bin. |
235 | | * If you get an error like this: ''ERROR: could not load library "c:/postgres/lib/rtpostgis.dll": The specified module could not be found'', simply add the /c/postgres/lib directory to PATH enviroment variable: export PATH=/c/postgres/lib/:$PATH |
236 | | |
237 | | '''2.3.3 - Compiling on Windows using Visual Studio''' |
238 | | |
| 140 | |
| 141 | As [http://gis4free.wordpress.com/2010/10/01/wkt-raster-is-now-postgis-raster/ PostGIS Raster is official part of PostGIS], you only need to compile PostGIS using special flag '--with-raster' in configure time. So, you'll first have to get the last PostGIS development snapshot from [http://postgis.refractions.net/download/postgis-2.0.0SVN.tar.gz here]. Or using a SVN client, checkout from [http://svn.osgeo.org/postgis/trunk here] |
| 142 | |
| 143 | Example with console SVN client: |
| 144 | |
| 145 | {{{ |
| 146 | >. svn checkout http://svn.osgeo.org/postgis/trunk postgis-svn |
| 147 | }}} |
| 148 | |
| 149 | Now, in case you checked out the code with a SVN client, you'll need to generate the configure script with: |
| 150 | |
| 151 | {{{ |
| 152 | >/autogen.sh |
| 153 | }}} |
| 154 | |
| 155 | In case you got the last development snapshot, the configure script is packed with the code. The next steps are: |
| 156 | |
| 157 | {{{ |
| 158 | >./configure --with-raster |
| 159 | > make |
| 160 | > sudo make install |
| 161 | }}} |
| 162 | |
| 163 | Now, you have PostGIS 2.0 with PostGIS Raster extension installed in your system. |
| 164 | |
| 165 | |
| 166 | PostgreSQL provides a utility called pg_config to enable extensions like PostGIS to locate the PostgreSQL installation directory. If ./configure didn't find pg_config, try using the --with-pgconfig=/path/to/pg_config switch to specify a particular PostgreSQL installation. |
| 167 | |
| 168 | |
| 169 | '''2.3.2 - Compiling on Windows''' |
| 170 | |
| 171 | Instructions are [wiki:UsersWikiWinCompile here]. Simply add '--with-raster' when invoking configure scripts. |
243 | | 1. Load the PostGIS Raster object and function definitions into your database by loading the rtpostgis.sql definitions file. |
244 | | |
245 | | {{{ |
246 | | >psql -d [yourdatabase] -f rtpostgis.sql |
247 | | }}} |
248 | | |
249 | | You can also do this directly in a pgAdmin III query dialog box if you administer your database using this software. |
250 | | |
251 | | The PostGIS Raster extension should now be loaded and ready to use. |
252 | | |
253 | | All files are installed using information provided by pg_config: |
| 176 | To create a new database and activate it with PostGIS and PostGIS Raster extensions, execute these steps from a console: |
| 177 | |
| 178 | {{{ |
| 179 | > createdb <your_database> |
| 180 | }}} |
| 181 | |
| 182 | {{{ |
| 183 | > createlang plpgsql <your_database> |
| 184 | }}} |
| 185 | |
| 186 | {{{ |
| 187 | > psql -U <your_user> -f postgis/postgis.sql -d <your_database> |
| 188 | }}} |
| 189 | |
| 190 | {{{ |
| 191 | > psql -U <your user> -f spatial_ref_sys.sql -d <your_database> |
| 192 | }}} |
| 193 | |
| 194 | {{{ |
| 195 | > psql -U <your user> -f raster/rt_pg/rtpostgis.sql -d <your_database> |
| 196 | }}} |
| 197 | |
| 198 | You can also do this directly in a pgAdmin III query dialog box if you administer your database using this software. |
| 199 | |
| 200 | The PostGIS Raster extension should now be loaded and ready to use. All files are installed using information provided by pg_config: |