Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there anyway to use custom map data (non OpenStreetMaps) from POSTGIS? #96

Open
stodge opened this issue Nov 29, 2013 · 4 comments
Open

Comments

@stodge
Copy link

stodge commented Nov 29, 2013

It looks like Kartograph assumes a certain POSTGIS table structure:

kartograph config.json -o map.svg
  cli.py, in render_map()
  71: K.generate(cfg, args.output, preview=args.preview, format=format, stylesheet=css)  kartograph.py, in generate()
  46: _map = Map(opts, self.layerCache, format=format)  map.py, in __init__()
  61: layer.get_features()  maplayer.py, in get_features()
  81: charset=layer.options['charset']  layersource/postgislayer.py, in get_features()
  64: cur.execute('SELECT "%s" FROM %s WHERE %s' % ('", "'.join(fields), self.table, query))
column "way" does not exist
LINE 1: ...polyline WHERE (layer_id = 19) AND ST_Intersects( way, ST_Se...

I assume that Kartograph therefore assumes you are using map data from OpenStreetMap in POSTGIS? Is there anyway to use custom map data from POSTGIS? Thanks

@gka
Copy link
Contributor

gka commented Nov 29, 2013

Oh, that's right, I only used this feature with OSM data. To support custom PostGIS we would need to specify which column contains the geo data? Or should we check the column type and use the first? What do you think?

@stodge
Copy link
Author

stodge commented Nov 29, 2013

I suppose the column could be specified in the json. Maybe:

{
    "layers": [
    {
        "id": "anotherlayer",
        "src": "postgis:dbname=dbname user=username password=password host=localhost",
        "table": "gis_polyline",
        "column": "the_geom",
        "query": "layer_id = 19"
    }
    ]
}

I assume the query option just specifies a WHERE clause?

@gka
Copy link
Contributor

gka commented Nov 29, 2013

yes, or rather a part of the WERE clause if you're using the bbox filter:

https://github.com/kartograph/kartograph.py/blob/master/kartograph/layersource/postgislayer.py#L49-L53

@gka
Copy link
Contributor

gka commented Nov 29, 2013

Btw, I just discovered that I already implemented automatic detection of geo column but I just forgot to use it in the bbox query.. Will fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants