1

I have successfully installed tilestache. I also has succesfully add a layer using shapefile from here. But when I tried to use my own shapefile, the server always return empty featurecollection. I have tried to add ST_Transform() in the query but still return empty feature.

My config file:

{
  "cache":
  {
    "name": "Test",
    "path": "/tmp/stache",
    "umask": "0000"
  },
  "layers":
  {
        "osm-processed_p1": {
            "allowed origin": "*",
            "provider": {
                "class": "TileStache.Goodies.VecTiles:Provider",
                "kwargs": {
                    "dbinfo": {
                        "host": "127.0.0.1",
                        "user": "postgres",
                        "database": "ts_data"
                    },
                    "queries": [
                        "SELECT gid, geom AS __geometry__ FROM osm.kalimantan"
                    ]
                }
            }
        }
  }
}

How can I fix this?

2
  • Well, first thing, your shapefile doesn't have a .prj sidecar file to convey its projection. So I'm betting that's the trouble.
    – elrobis
    Commented Aug 14, 2015 at 14:08
  • The shapefile is in WSG84. What if I don't have the .prj file? What can I do?
    – edmundpie
    Commented Aug 14, 2015 at 14:28

1 Answer 1

1

I noticed your shapefile has no .prj sidecar file. If you have installed the GDAL/OGR toolkit, it could be worth a try to attach the projection information to see if that brings everything to life.

Use ogr2ogr to fix it..

Your data appears to be in WGS84 (i.e. EPSG:4326), so the following ogr2ogr command will create a new version of your shapefile with a .prj file:

ogr2ogr -a_srs EPSG:4326 "C:\path\to\output\kalimantan_4326.shp" "C:\path\to\input\kalimantan.shp"

Or you can just manually fix it..

In this case it might just be easier to add a .prj file manually. To do that, open notepad, paste the following text, and save the file to the same folder as kalimantan.shp. Make sure to name the new file kalimantan.prj:

GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]

Make sure you're saving the file as kalimantan.prj, and NOT kalimantan.prj.txt, which Windows may do if you don't have "Hide extensions for known file types" checked in Folder Options!

My only remaining concern is that typically, when projection data is missing, open source GIS software will try to consume it as WGS84. But your data appears to be in WGS84, and that didn't happen. So I'm not 100% sure this will solve your problem--there may be another issue. I still think it's worth a shot, though.

1
  • still doesn't solve my problem.
    – edmundpie
    Commented Aug 14, 2015 at 21:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.