Updated Troubleshooting (markdown)
parent
46f4e405e3
commit
49b8e61ddf
1 changed files with 6 additions and 11 deletions
|
@ -17,22 +17,23 @@ Make sure to check out LearningMapnik for tips on certain topics, and ExampleCod
|
|||
|
||||
* *Solution*: This shapefile is bogus, and you need to fix it. *Usually* this problem can be fixed by clipping the extents of the shapefile before rendering with Mapnik. An easy way to do this is using the new clipping feature in GDAL 1.7. So, assuming a shapefile in WGS 84/EPS:4326 called 'sketchy_natural_earth.shp', fix it by doing:
|
||||
|
||||
|
||||
```sh
|
||||
$ ogr2ogr fixed.shp sketchy_natural_earth.shp -t_srs EPSG:900913 -clipsrc -180 -90 180 90
|
||||
```
|
||||
|
||||
* Note: if you get a long usage error it likely means you are not running GDAL 1.7!
|
||||
|
||||
* Note: the '-t_srs EPSG:900913' also reprojects it to Google mercator, which will allow Mapnik to render it faster. But the real reason we do this is to watch for whether ogr2ogr throws further errors. If is does, then your shapefile really as problems, and likely contains coordinates that are outside the value extent for Google (Spherical) Mercator. If this is the case then try:
|
||||
|
||||
|
||||
```sh
|
||||
$ ogr2ogr fixed.shp sketchy_natural_earth.shp -skipfailures -t_srs EPSG:900913 -clipsrc -180 -90 180 90
|
||||
```
|
||||
|
||||
* The '-skipfailures' tells ogr2ogr to skip any features containing bogus coordinates, which is good because they will potentially cause mapnik to render fewer shapes that you'd like (see #308).
|
||||
|
||||
* Now, if that results in a shapefile missing key chunks of data, then we need to up the ante and call in some sort of tool to actually clean the topology. You may know of some - in our experience importing into PostGIS, cleaning there, then exporting again to a shapefile works nicely. The clean script comes from Horst Duester and can be downloaded from here: http://www.sogis1.so.ch/sogis/dl/postgis/cleanGeometry.sql. Basically the dance looks like:
|
||||
|
||||
|
||||
#!sh
|
||||
```sh
|
||||
# download the one with the crazy
|
||||
wget http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/physical/10m-land.zip
|
||||
unzip 10m-land.zip
|
||||
|
@ -57,20 +58,14 @@ Make sure to check out LearningMapnik for tips on certain topics, and ExampleCod
|
|||
|
||||
# then, finally, clip it and hope that you don't get too many errors from og2ogr and your shapes look okay
|
||||
ogr2ogr fixed.shp cleaned_but_still_sketchy.shp -f "ESRI Shapefile" -skipfailures -t_srs EPSG:900913 -clipsrc -180 -90 180 90
|
||||
```
|
||||
|
||||
A bit more advanced version of this converted to a script can be found at https://github.com/springmeyer/seaweed/blob/master/clean_natural_earth.py
|
||||
|
||||
If this does not work, then go back to the person that gave you this shapefile and return it. Or check out http://trac.osgeo.org/postgis/wiki/UsersWikiCleanPolygons and see if any gurus have added new scripts.
|
||||
|
||||
|
||||
|
||||
|
||||
## OGCServer Fails to Load External Entities
|
||||
|
||||
* *Description*: OGCServer won't start after installation and configuration when using XML styling with external entities, but nik2img can still parse the files OK. Error message in server log: "I/O warning : failed to load external entity %entities;^"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
* *Solution*: Change all the paths in the XML style files AND external entity files from relative to absolute. Ensure line endings are the correct format for your operating system. I encountered this problem when porting my code from windows to mac. The source of the problem was found by commenting out most of the layers and scrutinising the file paths, it turned out that some of them were incorrect.
|
||||
|
|
Loading…
Reference in a new issue