Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
TileStach.vector PostGIS/ GeoJSON
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  Messages 1 - 25 of 36 - Collapse all  -  Translate all to Translated (View all originals)   Newer >
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
d.  
View profile   Translate to Translated (View Original)
 More options Aug 20 2012, 1:21 am
From: "d." <darw...@googlemail.com>
Date: Sun, 19 Aug 2012 22:21:32 -0700 (PDT)
Local: Mon, Aug 20 2012 1:21 am
Subject: TileStach.vector PostGIS/ GeoJSON

Hi all,

I have a problem with Tilestache. I got to set it up correctly
(localhost:8080/example/previews.html and osm/preview.html work just fine).
But when I want to set it up using GeoJSON or PostGIS it is just giving me
blank tiles.

My tilestache.cfg looks like this:

{
  "cache":
  {
    "name": "Disk",
    "path": "/tmp/stache",
    "umask": "0000"
  },
  "layers":
  {
    "osm":
    {
        "provider": {"name": "proxy", "provider": "OPENSTREETMAP"},
        "png options": {"palette":
"http://tilestache.org/example-palette-openstreetmap-mapnik.act"}
    },
    "example":
    {
        "provider": {"name": "mapnik", "mapfile": "examples/style.xml"},
        "projection": "spherical mercator"
    },
    "postgis":
    {
    "provider": {"name": "vector", "driver": "PostgreSQL","parameters":
                {"dbname": "webmap", "user": "postgres", "password":
"xxxxx", "table": "tilestache"
                }
                }
    },
    "geojson":
    {
    "provider": {"name": "vector", "driver": "GeoJSON",
                 "parameters": {"file": "geojsontest.json"}
        }
    }
  }

}

And while asking for localhost:8080/postgis/preview.html the server calls
127.0.0.1 - - [20/Aug/2012 07:17:28] "GET /postgis/preview.html HTTP/1.1"
200 -
INFO:werkzeug:127.0.0.1 - - [20/Aug/2012 07:17:28] "GET
/postgis/preview.html HTTP/1.1" 200 -
127.0.0.1 - - [20/Aug/2012 07:17:28] "GET /postgis/10/167/396.png HTTP/1.1"
200 -
INFO:werkzeug:127.0.0.1 - - [20/Aug/2012 07:17:28] "GET
/postgis/10/167/396.png HTTP/1.1" 200 -
127.0.0.1 - - [20/Aug/2012 07:17:29] "GET /postgis/10/166/397.png HTTP/1.1"
200 -
INFO:werkzeug:127.0.0.1 - - [20/Aug/2012 07:17:29] "GET
/postgis/10/166/397.png HTTP/1.1" 200 -
127.0.0.1 - - [20/Aug/2012 07:17:29] "GET /postgis/10/167/394.png HTTP/1.1"
200 -
INFO:werkzeug:127.0.0.1 - - [20/Aug/2012 07:17:29] "GET
/postgis/10/167/394.png HTTP/1.1" 200 -
127.0.0.1 - - [20/Aug/2012 07:17:29] "GET /postgis/10/167/397.png HTTP/1.1"
200 -
INFO:werkzeug:127.0.0.1 - - [20/Aug/2012 07:17:29] "GET
/postgis/10/167/397.png HTTP/1.1" 200 -
127.0.0.1 - - [20/Aug/2012 07:17:30] "GET /postgis/preview.html HTTP/1.1"
200 -
INFO:werkzeug:127.0.0.1 - - [20/Aug/2012 07:17:30] "GET
/postgis/preview.html HTTP/1.1" 200 -

However there are no files created it the tmp/stache directory at all, not
even one with 0kb.
The user login for postgis is alright, as i can access it from pgAdmin with
the same user/password also the tablename is correct. The json file can be
rendered correctly in polymaps itself, so no bad file format or something
like that.

I am running tilestache on ubuntu 12.04 64bit. I am just wondering why the
originial examples work and my basic tests fail.

Any help would be very much appreciated!
Thanks!
d.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michal Migurski  
View profile  
 More options Aug 20 2012, 1:26 am
From: Michal Migurski <m...@stamen.com>
Date: Sun, 19 Aug 2012 22:26:49 -0700
Local: Mon, Aug 20 2012 1:26 am
Subject: Re: [tilestache] TileStach.vector PostGIS/ GeoJSON
Hi D,

The preview.html page is designed to preview image tiles, but the vector provider returns JSON data tiles. Can you try changing some of the requests below to say ".json" instead of ".png" on the end?

-mike.

On Aug 19, 2012, at 10:21 PM, d. wrote:

----------------------------------------------------------------
michal migurski- m...@stamen.com
                 415.558.1610

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
d.  
View profile   Translate to Translated (View Original)
 More options Aug 21 2012, 11:24 am
From: "d." <darw...@googlemail.com>
Date: Tue, 21 Aug 2012 08:24:31 -0700 (PDT)
Local: Tues, Aug 21 2012 11:24 am
Subject: Re: TileStach.vector PostGIS/ GeoJSON

Hi mike,

when I change the tilestache.cfg to

{
  "cache":
  {
    "name": "Disk",
    "path": "/tmp/stache",
    "umask": "0000"
  },
  "layers":
  {
    "osm":
    {
        "provider": {"name": "proxy", "provider": "OPENSTREETMAP"},
        "png options": {"palette":
"http://tilestache.org/example-palette-openstreetmap-mapnik.act"}
    },
    "example":
    {
        "provider": {"name": "mapnik", "mapfile": "examples/style.xml"},
        "projection": "spherical mercator"
    },
    "postgis":
    {
    "provider": {"name": "vector", "driver": "PostgreSQL","parameters":
                {"dbname": "webmap", "user": "xxx", "password": "xxx",
"table": "tilestache"
                }
                },
    "preview":  {"lat": 0,"lon": 0, "zoom": 5,"ext": "json"
            }
    },
    "geojson":
    {
    "provider": {"name": "vector", "driver": "GeoJSON",
                 "parameters": {"file": "geojsontest.json"}
        },
    "preview":  {"lat": 0,"lon": 0, "zoom": 5,"ext": "json"
            }
    }
  }

}

I have the same empty tile output in the webbrowser and can't find any
tiles in the /tmp/stache folder. The terminal gives me here:
127.0.0.1 - - [21/Aug/2012 17:21:12] "GET /geojson/5/18/17.json HTTP/1.1"
200 -
INFO:werkzeug:127.0.0.1 - - [21/Aug/2012 17:21:12] "GET
/geojson/5/18/17.json HTTP/1.1" 200 -
127.0.0.1 - - [21/Aug/2012 17:21:12] "GET /geojson/5/18/14.json HTTP/1.1"
200 -
INFO:werkzeug:127.0.0.1 - - [21/Aug/2012 17:21:12] "GET
/geojson/5/18/14.json HTTP/1.1" 200 -
127.0.0.1 - - [21/Aug/2012 17:21:13] "GET /geojson/5/17/18.json HTTP/1.1"
200 -
INFO:werkzeug:127.0.0.1 - - [21/Aug/2012 17:21:13] "GET
/geojson/5/17/18.json HTTP/1.1" 200 -
127.0.0.1 - - [21/Aug/2012 17:21:13] "GET /geojson/5/14/18.json HTTP/1.1"
200 -
INFO:werkzeug:127.0.0.1 - - [21/Aug/2012 17:21:13] "GET
/geojson/5/14/18.json HTTP/1.1" 200 -
127.0.0.1 - - [21/Aug/2012 17:21:13] "GET /geojson/preview.html HTTP/1.1"
200 -
INFO:werkzeug:127.0.0.1 - - [21/Aug/2012 17:21:13] "GET
/geojson/preview.html HTTP/1.1" 200 -
127.0.0.1 - - [21/Aug/2012 17:21:14] "GET /geojson/5/18/18.json HTTP/1.1"
200 -
INFO:werkzeug:127.0.0.1 - - [21/Aug/2012 17:21:14] "GET
/geojson/5/18/18.json HTTP/1.1" 200 -
127.0.0.1 - - [21/Aug/2012 17:21:14] "GET /geojson/preview.html HTTP/1.1"
200 -
INFO:werkzeug:127.0.0.1 - - [21/Aug/2012 17:21:14] "GET
/geojson/preview.html HTTP/1.1" 200 -

so no error. Is it possible that tilestache is only serving tiles/jsons
when I request them via polymaps?
Could you maybe post me a example.html for using polymaps with
tilestache.vector postgis? a very basic one would probably help.

Any other thoughts are welcome.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Todd Albert  
View profile  
 More options Aug 22 2012, 11:52 am
From: Todd Albert <toddalb...@gmail.com>
Date: Wed, 22 Aug 2012 08:52:41 -0700 (PDT)
Local: Wed, Aug 22 2012 11:52 am
Subject: Re: TileStach.vector PostGIS/ GeoJSON

I am struggling with the same basic setup. I am using polymaps and
overlaying a very large vector layer (600,000+ polygons!).

I created a small subset of the polygons and put these into a .json file.
This overlays on the map beautifully.

The entire dataset is too large and must be tiled. So I've turned to
TileStache.

I've tried this several ways and have yet to find a working solution.

I've used a straight .json file and asked TileStache to tile it. No dice.
Not even when using the smaller subset.

I've imported the data into my PostGIS database, but when I try to access
the tiles, I am told that TileStache cannot connect to the database using
my dbuser/pw. I have checked these settings multiple times. I can access
the database using these settings, but TileStache cannot?

Finally, I used TileMill to create a (huge) .mbtiles file. TileStache is
able to serve the mbtiles, but it is extremely slow and doesn't show every
tile. This method, while it looks ok (not as nice as vectors), it does not
suffice since I have data associated with each polygon that I need access
to.

Any help on getting TileStache to work with my .json file (GeoJSON format)
would be greatly appreciated!

Also, Michal, is there a way to preview your vector layers using a method
similar to previe.html?

Thanks,
Todd


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
d.  
View profile   Translate to Translated (View Original)
 More options Aug 22 2012, 5:03 pm
From: "d." <darw...@googlemail.com>
Date: Wed, 22 Aug 2012 14:03:33 -0700 (PDT)
Local: Wed, Aug 22 2012 5:03 pm
Subject: Re: TileStach.vector PostGIS/ GeoJSON

Hi Todd and Michael.

@ Todd: You got an error message when you tried to enter the PostGIS-DB?
The strange thing for me is, that I do not get even though if I am entering
the wrong connection parameters.

@ all:
I have now created a test-html with polymaps. I also added the "host"
paramters to my tilestache.vector - PostGIS provided db.
I have still the same results with the preview, which does not wonder me,
since tilestache.vescot delivers *.jsons.
The test.hml  + polymaps code looks like the following

*geojsontest.js:*
var po = org.polymaps;

var map = po.map()
    .container(document.getElementById("map").appendChild(po.svg("svg")))
    .zoom(1)
    .zoomRange([1, 10])
    .add(po.interact());

map.add(po.image()
    .url(po.url("http://{S}tile.cloudmade.com"
    + "/1a1b06b230af4efdbb989ea99e9841af"
    + "/20760/256/{Z}/{X}/{Y}.png")
    .hosts(["a.", "b.", "c.", ""])));

map.add(po.geoJson()
    .url("http://127.0.0.1:8080/postgis/{Z}/{X}/{Y}.json")
    .id("points")
    .on("load", load));

function load(e) {
  for (var i = 0; i < e.features.length; i++) {
    var feature = e.features[i];
    feature.element.appendChild(po.svg("circle")
        .appendChild(document.createTextNode(feature.data.id))
        .parentNode);

map.add(po.compass()
    .pan("none"));

}
}

*geojsontest.html:*
<!DOCTYPE html>
<html>
  <head>
    <title>GeoJSON Test</title>
    <script type="text/javascript" src="polymaps.js"></script>
    <style type="text/css">

@import url("example.css");
body    {
      background: #E6E6E6;
    }

.layer path    {
        fill: none;
        vector-effect: non-scaling-stroke;
        }

    </style>
  </head>
  <body id="map">
    <script type="text/javascript" src="geojsontest.js"></script>
  </body>
</html>

when I have the polymaps po.geojson object configured as a local geojson
file, everything works perfectly, when set it up like abothe and try to get
out tiles out of tilestache, der is no error in the terminal window i run
tilestache in, but firebug gives me the following for each tile:

GET http://127.0.0.1:8080/postgis/1/0/1.json
200 OK
1.58s
polymaps.js (line 307)
GET http://127.0.0.1:8080/postgis/1/0/1.json
200 OK
1.58s
polymaps.js (line 307)
GET http://127.0.0.1:8080/postgis/1/1/1.json
200 OK
1.6s
polymaps.js (line 307)
GET http://127.0.0.1:8080/postgis/1/0/0.json
200 OK
1.95s
polymaps.js (line 307)

in specific for one:
Response Headers
Content-Length5250Content-Typetext/plainDateWed, 22 Aug 2012 18:25:10 GMT
ServerWerkzeug/0.8.3 Python/2.7.3
Request Headers
Accepttext/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encodinggzip, deflateAccept-Languageen-us,en;q=0.5Connection
keep-aliveHost127.0.0.1:8080Originhttp://localhostReferer
http://localhost/polymaps/test/GeoJSON/geojsontest.htmlUser-AgentMozi...
(X11; Ubuntu; Linux x86_64; rv:14.0) Gecko/20100101 Firefox/14.0.1
and polymaps.js says on line 307
req.send(null);

Thats it. No vectors are beeing shown. Btw the SRID of my postgisdb is 4326
- do I maybe have to use 900913? As in another topic somebody wrote that is
problem was the unmatching zoomlevels of the tiles and the layers -> how do
I get (if that is possbile) the zoomlevel out of a postgis db?

any thoughts on this? I really want to get this going :/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michal Migurski  
View profile  
 More options Aug 22 2012, 5:40 pm
From: Michal Migurski <m...@stamen.com>
Date: Wed, 22 Aug 2012 23:40:22 +0200
Local: Wed, Aug 22 2012 5:40 pm
Subject: Re: [tilestache] Re: TileStach.vector PostGIS/ GeoJSON
Hi Todd,

I'll just answer a small part of your question since I'm traveling with limited email access for the moment. Can you paste here your postgres settings in the config file, alongside the psql command you run to connect to the database? If you are comfortable with Python, can you attempt to connect using the psycopg2 library that TileStache uses under the hood? Are you using Mapnik at all, and does it have trouble connecting? It would help to see more information to help troubleshoot the postgres connection.

-mike.

On Aug 22, 2012, at 5:52 PM, Todd Albert wrote:

----------------------------------------------------------------
michal migurski- m...@stamen.com
                 415.558.1610

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Todd Albert  
View profile   Translate to Translated (View Original)
 More options Aug 23 2012, 12:24 am
From: Todd Albert <toddalb...@gmail.com>
Date: Wed, 22 Aug 2012 21:24:36 -0700 (PDT)
Local: Thurs, Aug 23 2012 12:24 am
Subject: Re: [tilestache] Re: TileStach.vector PostGIS/ GeoJSON

*Mike,

Thanks for the reply. Here are my settings in
/etc/postgresql/9.1/main/postgresql.conf:*

# -----------------------------
# PostgreSQL configuration file
# -----------------------------
#
# This file consists of lines of the form:
#
#   name = value
#
# (The "=" is optional.)  Whitespace may be used.  Comments are introduced
with
# "#" anywhere on a line.  The complete list of parameter names and allowed
# values can be found in the PostgreSQL documentation.
#
# The commented-out settings shown in this file represent the default
values.
# Re-commenting a setting is NOT sufficient to revert it to the default
value;
# you need to reload the server.
#
# This file is read on server startup and when the server receives a SIGHUP
# signal.  If you edit the file on a running system, you have to SIGHUP the
# server for the changes to take effect, or use "pg_ctl reload".  Some
# parameters, which are marked below, require a server shutdown and restart
to
# take effect.
#
# Any parameter can also be given as a command-line option to the server,
e.g.,
# "postgres -c log_connections=on".  Some parameters can be changed at run
time
# with the "SET" SQL command.
#
# Memory units:  kB = kilobytes        Time units:  ms  = milliseconds
#                MB = megabytes                     s   = seconds
#                GB = gigabytes                     min = minutes
#                                                   h   = hours
#                                                   d   = days

#-------------------------------------------------------------------------- ----
# FILE LOCATIONS
#-------------------------------------------------------------------------- ----

# The default values of these variables are driven from the -D command-line
# option or PGDATA environment variable, represented here as ConfigDir.

data_directory = '/var/lib/postgresql/9.1/main'        # use data in
another directory
                    # (change requires restart)
hba_file = '/etc/postgresql/9.1/main/pg_hba.conf'    # host-based
authentication file
                    # (change requires restart)
ident_file = '/etc/postgresql/9.1/main/pg_ident.conf'    # ident
configuration file
                    # (change requires restart)

# If external_pid_file is not explicitly set, no extra PID file is written.
external_pid_file = '/var/run/postgresql/9.1-main.pid'        # write an
extra PID file
                    # (change requires restart)

#-------------------------------------------------------------------------- ----
# CONNECTIONS AND AUTHENTICATION
#-------------------------------------------------------------------------- ----

# - Connection Settings -

listen_addresses = '*'        # what IP address(es) to listen on;
                    # comma-separated list of addresses;
                    # defaults to 'localhost', '*' = all
                    # (change requires restart)
port = 5432                # (change requires restart)
max_connections = 100            # (change requires restart)
# Note:  Increasing max_connections costs ~400 bytes of shared memory per
# connection slot, plus lock space (see max_locks_per_transaction).
#superuser_reserved_connections = 3    # (change requires restart)
unix_socket_directory = '/var/run/postgresql'        # (change requires
restart)
#unix_socket_group = ''            # (change requires restart)
#unix_socket_permissions = 0777        # begin with 0 to use octal notation
                    # (change requires restart)
#bonjour = off                # advertise server via Bonjour
                    # (change requires restart)
#bonjour_name = ''            # defaults to the computer name
                    # (change requires restart)

# - Security and Authentication -

#authentication_timeout = 1min        # 1s-600s
ssl = true                # (change requires restart)
#ssl_ciphers = 'ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH'    # allowed SSL ciphers
                    # (change requires restart)
#ssl_renegotiation_limit = 512MB    # amount of data between renegotiations
#password_encryption = on
#db_user_namespace = off

# Kerberos and GSSAPI
#krb_server_keyfile = ''
#krb_srvname = 'postgres'        # (Kerberos only)
#krb_caseins_users = off

# - TCP Keepalives -
# see "man 7 tcp" for details

#tcp_keepalives_idle = 0        # TCP_KEEPIDLE, in seconds;
                    # 0 selects the system default
#tcp_keepalives_interval = 0        # TCP_KEEPINTVL, in seconds;
                    # 0 selects the system default
#tcp_keepalives_count = 0        # TCP_KEEPCNT;
                    # 0 selects the system default

#-------------------------------------------------------------------------- ----
# RESOURCE USAGE (except WAL)
#-------------------------------------------------------------------------- ----

# - Memory -

shared_buffers = 24MB            # min 128kB
                    # (change requires restart)
#temp_buffers = 8MB            # min 800kB
#max_prepared_transactions = 0        # zero disables the feature
                    # (change requires restart)
# Note:  Increasing max_prepared_transactions costs ~600 bytes of shared
memory
# per transaction slot, plus lock space (see max_locks_per_transaction).
# It is not advisable to set max_prepared_transactions nonzero unless you
# actively intend to use prepared transactions.
#work_mem = 1MB                # min 64kB
#maintenance_work_mem = 16MB        # min 1MB
#max_stack_depth = 2MB            # min 100kB

# - Kernel Resource Usage -

#max_files_per_process = 1000        # min 25
                    # (change requires restart)
#shared_preload_libraries = ''        # (change requires restart)

# - Cost-Based Vacuum Delay -

#vacuum_cost_delay = 0ms        # 0-100 milliseconds
#vacuum_cost_page_hit = 1        # 0-10000 credits
#vacuum_cost_page_miss = 10        # 0-10000 credits
#vacuum_cost_page_dirty = 20        # 0-10000 credits
#vacuum_cost_limit = 200        # 1-10000 credits

# - Background Writer -

#bgwriter_delay = 200ms            # 10-10000ms between rounds
#bgwriter_lru_maxpages = 100        # 0-1000 max buffers written/round
#bgwriter_lru_multiplier = 2.0        # 0-10.0 multipler on buffers
scanned/round

# - Asynchronous Behavior -

#effective_io_concurrency = 1        # 1-1000. 0 disables prefetching

#-------------------------------------------------------------------------- ----
# WRITE AHEAD LOG
#-------------------------------------------------------------------------- ----

# - Settings -

#wal_level = minimal            # minimal, archive, or hot_standby
                    # (change requires restart)
#fsync = on                # turns forced synchronization on or off
#synchronous_commit = on        # synchronization level; on, off, or local
#wal_sync_method = fsync        # the default is the first option
                    # supported by the operating system:
                    #   open_datasync
                    #   fdatasync (default on Linux)
                    #   fsync
                    #   fsync_writethrough
                    #   open_sync
#full_page_writes = on            # recover from partial page writes
#wal_buffers = -1            # min 32kB, -1 sets based on shared_buffers
                    # (change requires restart)
#wal_writer_delay = 200ms        # 1-10000 milliseconds

#commit_delay = 0            # range 0-100000, in microseconds
#commit_siblings = 5            # range 1-1000

# - Checkpoints -

#checkpoint_segments = 3        # in logfile segments, min 1, 16MB each
#checkpoint_timeout = 5min        # range 30s-1h
#checkpoint_completion_target = 0.5    # checkpoint target duration, 0.0 -
1.0
#checkpoint_warning = 30s        # 0 disables

# - Archiving -

#archive_mode = off        # allows archiving to be done
                # (change requires restart)
#archive_command = ''        # command to use to archive a logfile segment
#archive_timeout = 0        # force a logfile segment switch after this
                # number of seconds; 0 disables

#-------------------------------------------------------------------------- ----
# REPLICATION
#-------------------------------------------------------------------------- ----

# - Master Server -

# These settings are ignored on a standby server

#max_wal_senders = 0        # max number of walsender processes
                # (change requires restart)
#wal_sender_delay = 1s        # walsender cycle time, 1-10000 milliseconds
#wal_keep_segments = 0        # in logfile segments, 16MB each; 0 disables
#vacuum_defer_cleanup_age = 0    # number of xacts by which cleanup is
delayed
#replication_timeout = 60s    # in milliseconds; 0 disables
#synchronous_standby_names = ''    # standby servers that provide sync rep
                # comma-separated list of application_name
                # from standby(s); '*' = all

# - Standby Servers -

# These settings are ignored on a master server

#hot_standby = off            # "on" allows queries during recovery
                    # (change requires restart)
#max_standby_archive_delay = 30s    # max delay before canceling queries
                    # when reading WAL from archive;
                    # -1 allows indefinite delay
#max_standby_streaming_delay = 30s    # max delay before canceling queries
                    # when reading streaming WAL;
                    # -1 allows indefinite delay
#wal_receiver_status_interval = 10s    # send replies at least this often
                    # 0 disables
#hot_standby_feedback = off        # send info from standby to prevent
                    # query conflicts

#-------------------------------------------------------------------------- ----
# QUERY TUNING
#-------------------------------------------------------------------------- ----

# - Planner Method Configuration -

#enable_bitmapscan = on
#enable_hashagg = on
#enable_hashjoin = on
#enable_indexscan = on
#enable_material = on
#enable_mergejoin = on
#enable_nestloop = on
#enable_seqscan = on ...

read more »


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Todd Albert  
View profile  
 More options Aug 23 2012, 10:18 pm
From: Todd Albert <toddalb...@gmail.com>
Date: Thu, 23 Aug 2012 19:18:15 -0700 (PDT)
Local: Thurs, Aug 23 2012 10:18 pm
Subject: Re: [tilestache] Re: TileStach.vector PostGIS/ GeoJSON

I seemed to have honed in on the problem.

My apache error logs show that there is a problem when I try to use vectors
in TileStache. The script is hanging up in TileStache/Vector/__init__.py,
line 378, which has the command:
     driver = ogr.GetDriverByName(str(driver_name))

The error that is returned is that 'ogr' is not defined.

I have no trouble accessing ogr from bash, but I tried within python and
ogr is unreachable. The command "from osgeo import ogr" within python
yields the error:
File "<stdin>", line 1, in <module>
ImportError: No module named osgeo

So, apparently, GDAL/OGR is installed properly and python is installed
properly, but either the bindings are not installed properly or their is a
config-file or path not setup correctly.

Anyone have any suggestions here?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Todd Albert  
View profile  
 More options Aug 24 2012, 10:16 am
From: Todd Albert <toddalb...@gmail.com>
Date: Fri, 24 Aug 2012 07:16:12 -0700 (PDT)
Local: Fri, Aug 24 2012 10:16 am
Subject: Re: [tilestache] Re: TileStach.vector PostGIS/ GeoJSON

Ok, I've gotten Python talking to GDAL now thanks to:
http://blog.mackerron.com/2012/06/01/postgis-2-ubuntu-12-04/

Then Python wouldn't talk to PostGIS / PostgreSQL because psycopg2 wasn't
intalled correctly. I simply did:
http://www.ehow.com/how_8614778_install-psycopg2-ubuntu-pip.html

Now the commands:
    from osgeo import ogr
and
    import psycopg2
both work in python.

So why am I still unable to connect to the database?!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Todd Albert  
View profile  
 More options Aug 24 2012, 10:41 am
From: Todd Albert <toddalb...@gmail.com>
Date: Fri, 24 Aug 2012 07:41:41 -0700 (PDT)
Local: Fri, Aug 24 2012 10:41 am
Subject: Re: [tilestache] Re: TileStach.vector PostGIS/ GeoJSON

Making progress…

Now I got python and postgresql talking. Now I need to get TileStache
working. Well, it works… it will serve tiles from direct data sources, but
not (yet) the database.

Do I have something wrong in my tilestache.cfg?

Here's the important bit:

"parcels2":
{
    "provider": {"name": "vector", "driver": "postgis",
    "parameters": {"dbname": "gis", "user": "gisuser",
                               "password": "gogo", "table": "parcels"}}

},



 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Todd Albert  
View profile  
 More options Aug 24 2012, 1:44 pm
From: Todd Albert <toddalb...@gmail.com>
Date: Fri, 24 Aug 2012 10:44:32 -0700 (PDT)
Local: Fri, Aug 24 2012 1:44 pm
Subject: Re: [tilestache] Re: TileStach.vector PostGIS/ GeoJSON

Still no luck on this, Mike. I am able to produce a .geojson tile from a
.json source, but still not from my database.

I've assured that everything is properly installed, the database is
working, and everything seems to be setup correctly, but… when I request a
single tile from the database, I still get a 500 Internal Server Error. A
look at the apache error log shows:

[Fri Aug 24 10:21:11 2012] [error] [client 192.168.37.1] mod_python
(pid=1484, interpreter='localhost', phase='PythonHandler',
handler='TileStache::modpythonHandler'): Application error
[Fri Aug 24 10:21:11 2012] [error] [client 192.168.37.1] ServerName:
'localhost'
[Fri Aug 24 10:21:11 2012] [error] [client 192.168.37.1] DocumentRoot:
'/var/www'
[Fri Aug 24 10:21:11 2012] [error] [client 192.168.37.1] URI:
'/tiles/tiles.py/parcels2/16/18185/27794.geojson'
[Fri Aug 24 10:21:11 2012] [error] [client 192.168.37.1] Location: None
[Fri Aug 24 10:21:11 2012] [error] [client 192.168.37.1] Directory:
'/var/www/tiles/'
[Fri Aug 24 10:21:11 2012] [error] [client 192.168.37.1] Filename:
'/var/www/tiles/tiles.py'
[Fri Aug 24 10:21:11 2012] [error] [client 192.168.37.1] PathInfo:
'/parcels2/16/18185/27794.geojson'
[Fri Aug 24 10:21:11 2012] [error] [client 192.168.37.1] Traceback (most
recent call last):
[Fri Aug 24 10:21:11 2012] [error] [client 192.168.37.1]   File
"/usr/lib/python2.7/dist-packages/mod_python/importer.py", line 1537, in
HandlerDispatch\n    default=default_handler, arg=req, silent=hlist.silent)
[Fri Aug 24 10:21:11 2012] [error] [client 192.168.37.1]   File
"/usr/lib/python2.7/dist-packages/mod_python/importer.py", line 1229, in
_process_target\n    result = _execute_target(config, req, object, arg)
[Fri Aug 24 10:21:11 2012] [error] [client 192.168.37.1]   File
"/usr/lib/python2.7/dist-packages/mod_python/importer.py", line 1128, in
_execute_target\n    result = object(arg)
[Fri Aug 24 10:21:11 2012] [error] [client 192.168.37.1]   File
"/usr/local/lib/python2.7/dist-packages/TileStache/__init__.py", line 462,
in modpythonHandler\n    mimetype, content = requestHandler(config_path,
path_info, query_string)
[Fri Aug 24 10:21:11 2012] [error] [client 192.168.37.1]   File
"/usr/local/lib/python2.7/dist-packages/TileStache/__init__.py", line 287,
in requestHandler\n    mimetype, content = getTile(layer, coord, extension)
[Fri Aug 24 10:21:11 2012] [error] [client 192.168.37.1]   File
"/usr/local/lib/python2.7/dist-packages/TileStache/__init__.py", line 96,
in getTile\n    tile = layer.render(coord, format)
[Fri Aug 24 10:21:11 2012] [error] [client 192.168.37.1]   File
"/usr/local/lib/python2.7/dist-packages/TileStache/Core.py", line 384, in
render\n    tile = provider.renderTile(width, height, srs, coord)
[Fri Aug 24 10:21:11 2012] [error] [client 192.168.37.1]   File
"/usr/local/lib/python2.7/dist-packages/TileStache/Vector/__init__.py",
line 561, in renderTile\n    layer, ds = _open_layer(self.driver,
self.parameters, self.layer.config.dirpath)
[Fri Aug 24 10:21:11 2012] [error] [client 192.168.37.1]   File
"/usr/local/lib/python2.7/dist-packages/TileStache/Vector/__init__.py",
line 436, in _open_layer\n    datasource = driver.Open(str(source_name))
[Fri Aug 24 10:21:11 2012] [error] [client 192.168.37.1] AttributeError:
'NoneType' object has no attribute 'Open'

If I am defining PostgreSQL as my provider, I am not sure why the script is
even executing line 436.

Please, please, please help me out here. I need to get this running by
Monday.

Desperately,
Todd


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michal Migurski  
View profile  
 More options Aug 25 2012, 7:33 am
From: Michal Migurski <m...@stamen.com>
Date: Sat, 25 Aug 2012 12:33:57 +0100
Local: Sat, Aug 25 2012 7:33 am
Subject: Re: [tilestache] Re: TileStach.vector PostGIS/ GeoJSON
Hi Todd,

You're at least doing everything right. Line 436 is reached because the gdal datasource is defined here:
        https://github.com/migurski/TileStache/blob/master/TileStache/Vector/...

Gdal wants a string like "PG:dbname='foo' user='blah'" in order to make a connection to the database. What happens if you execute this minimal bit of Python?

        from osgeo import ogr
        driver = ogr.GetDriverByName('PostgreSQL')
        src_name = "PG:dbname='gis' user='gisuser' password='gogo' table='parcels'"
        datasource = driver.Open(src_name)
        assert datasource

I'm still traveling, but I'll be on email later tonight (UK time).

-mike.

On Aug 24, 2012, at 6:44 PM, Todd Albert wrote:

----------------------------------------------------------------
michal migurski- m...@stamen.com
                 415.558.1610

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Todd Albert  
View profile  
 More options Aug 25 2012, 10:10 am
From: Todd Albert <to...@me.com>
Date: Sat, 25 Aug 2012 10:10:11 -0400
Local: Sat, Aug 25 2012 10:10 am
Subject: Re: [tilestache] Re: TileStach.vector PostGIS/ GeoJSON
Mike,

I tried executing ogrinfo PG:"dbname:'gis' user:'gisuser'"
(or whatever the proper command is - I'm on my phone at the moment) from bash and it failed because OGR was not installed with the PG driver.

So, I rebuilt GDAL with Python, Geos, and PostgreSQL, all configured properly (I think), and reinstalled. I also reinstalled PostgreSQL and PostGIS.

Still no dice. Still no driver.

So, it's obviously not a TileStache bug. It's that I can't seem to get GDAL/OGR installed with the required PG driver.

Any thoughts or suggestions?

Thanks,
Todd

P.S. safe travels!

On Aug 25, 2012, at 7:33 AM, Michal Migurski <m...@stamen.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michal Migurski  
View profile  
 More options Aug 25 2012, 1:21 pm
From: Michal Migurski <m...@stamen.com>
Date: Sat, 25 Aug 2012 18:21:02 +0100
Local: Sat, Aug 25 2012 1:21 pm
Subject: Re: [tilestache] Re: TileStach.vector PostGIS/ GeoJSON
Looking back to your previous posts, I see that you used this to install the ogr bindings:
        http://blog.mackerron.com/2012/06/01/postgis-2-ubuntu-12-04/

My experience with Postgis 2.0 is very limited, and I can see that the instructions you followed include postgres in the gdal build step. Did you see any errors go by when you did that, about missing postgres-anything?

Maybe a more blunt question: do you actually need postgis 2.0, or would it be enough to use the older postgis 1.5 which is well-supported in Ubuntu package managers? I've only installed Postgis 2.0 once myself, and I remember it being a multiple-hours-long affair that I only put myself through because I needed the offset curves function. Maybe you can get by without it?

I'll fire up a 12.04 machine and try to retrace your steps.

-mike.

On Aug 25, 2012, at 3:10 PM, Todd Albert wrote:

----------------------------------------------------------------
michal migurski- m...@stamen.com
                 415.558.1610

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michal Migurski  
View profile  
 More options Aug 25 2012, 1:53 pm
From: Michal Migurski <m...@stamen.com>
Date: Sat, 25 Aug 2012 18:53:31 +0100
Local: Sat, Aug 25 2012 1:53 pm
Subject: Re: [tilestache] Re: TileStach.vector PostGIS/ GeoJSON
Hi Todd,

I followed George MacKerron's instructions on a clean Ubuntu 12.04 install, with some minor differences:

- I have skipped PostGIS 2.0 since it's not really the part I'm testing
- I modified /etc/postgresql/9.1/main/pg_hba.conf, to set all methods to "trust" (so passwords, etc. wouldn't be needed)

...and this works:
        from sys import path
        path.append('/opt/gdal/lib/python2.7/site-packages') # needed due to /opt prefix from build
        from osgeo import ogr
        driver = ogr.GetDriverByName('PostgreSQL')
        src_name = "PG:dbname='postgres' user='postgres'"
        datasource = driver.Open(src_name)
        assert datasource

So I've at least gotten a working PG driver this way. Does the sys.path line above look like something you've done as well? Might you be importing from the wrong osgeo package? What about the edit to pg_hba.conf? I typically set everything to "trust" when I work with Postgres on my own systems, might that be an important difference?

-mike.

On Aug 25, 2012, at 6:21 PM, Michal Migurski wrote:

----------------------------------------------------------------
michal migurski- m...@stamen.com
                 415.558.1610

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Todd Albert  
View profile  
 More options Aug 25 2012, 8:26 pm
From: Todd Albert <to...@me.com>
Date: Sat, 25 Aug 2012 20:26:11 -0400
Local: Sat, Aug 25 2012 8:26 pm
Subject: Re: [tilestache] TileStach.vector PostGIS/ GeoJSON

Hi Mike,

Ok, this sounds promising…

I tried George MacKerron's instructions again, but without the prefix to simplify things. I skipped PostGIS. I will probably need it later on, but I don't think I need 2.0 for any reason.

I got everything installed and then ran, line-by-line in Python:

>>>  from osgeo import ogr
>>>  driver=ogr.GetDriverByName('PostgreSQL')
>>>  src_name="PG:dbname='gis' user='gisuser'"
>>>  datasource=driver.Open(src_name)

And then I got the error:

   NameError: name 'driver' is not defined

I assume this means that PostgreSQL is not a valid driver.

So I don't think this solved the problem.

I even tried the "from sys import path" line first.

I did edit pg_hba.conf to set everything to trust.

I don't think I am importing from the wrong osgeo package, because before I rebuilt it, the line "from osgeo import ogr" wasn't working. And I uninstalled the package before rebuilding it.

At bash, the command ogrinfo -- formats does not list a PG, PostgreSQL, or PostGIS driver. The closest thing I see is DXF or PGDump. So I am back to thinking that even though I am configuring gdal with PostgreSQL (--with-pg=/usr/lib/postgresql/9.1/bin/pg_config), it doesn't seem to be installing that driver. Ugh!

So I'm still stuck here… but I feel like I am SO close!!  Any other ideas??

Thanks so much for all of the help!!

-Todd

On Aug 25, 2012, at 1:53 PM, Michal Migurski <m...@stamen.com> wrote:

...

read more »


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Todd Albert  
View profile  
 More options Aug 25 2012, 10:37 pm
From: Todd Albert <to...@me.com>
Date: Sat, 25 Aug 2012 22:37:22 -0400
Local: Sat, Aug 25 2012 10:37 pm
Subject: Re: [tilestache] TileStach.vector PostGIS/ GeoJSON
Mike, you're really haloing me out here!

Ok, so far this works (see below). But I have not yet installed mapnik, apache, and tilestache, nor have I imported any data into my database. But the PG driver is installed in OGR and working from Python.

As for the rest, I'll keep you posted…

# from a clean install of Ubuntu-Server
sudo aptitude update
sudo aptitude upgrade

# install prerequisites
sudo aptitude install build-essential checkinstall postgresql \
  postgresql-server-dev-9.1 libjson0-dev libxml2-dev libproj-dev \
  python2.7-dev swig

cd ~
mkdir -p src

# download and compile geos
cd ~/src/
wget http://download.osgeo.org/geos/geos-3.3.5.tar.bz2
tar -xvjf geos-3.3.5.tar.bz2
cd geos-3.3.5
./configure --enable-python
make -j2
sudo checkinstall  # uninstall with: dpkg -r geos

# download and compile gdal
cd ~/src/
wget http://download.osgeo.org/gdal/gdal-1.9.1.tar.gz
tar -xvzf gdal-1.9.1.tar.gz
cd gdal-1.9.1/
./configure --with-geos=/usr/local/bin/geos-config \
  --with-pg=/usr/lib/postgresql/9.1/bin/pg_config --with-python
make -j2
sudo checkinstall  # uninstall with: dpkg -r gdal

sudo ldconfig

sudo -u postgres -iH

# create a user within the database
createuser -SdRP gisuser

# create a database
createdb -E UTF8 -O gisuser gis
exit

# configure access to our database

sudo nano /etc/postgresql/9.1/main/pg_hba.conf

# Scroll to bottom and change the words ident and md5 to “trust”

sudo /etc/init.d/postgresql start


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michal Migurski  
View profile  
 More options Aug 25 2012, 11:03 pm
From: Michal Migurski <m...@stamen.com>
Date: Sun, 26 Aug 2012 04:03:38 +0100
Local: Sat, Aug 25 2012 11:03 pm
Subject: Re: [tilestache] TileStach.vector PostGIS/ GeoJSON
On Aug 26, 2012, at 1:26 AM, Todd Albert wrote:

This is actually really weird. A NameError is raised when a variable doesn't exist, which shouldn't be true no matter what the return value of ogr.GetDriverByName is. It could be None or False or whatever, and you still should not be seeing a NameError from these four lines of Python *no matter what*.

-mike.

----------------------------------------------------------------
michal migurski- m...@stamen.com
                 415.558.1610


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Todd Albert  
View profile  
 More options Aug 26 2012, 12:13 am
From: Todd Albert <to...@me.com>
Date: Sun, 26 Aug 2012 00:13:34 -0400
Local: Sun, Aug 26 2012 12:13 am
Subject: Re: [tilestache] TileStach.vector PostGIS/ GeoJSON

Below is a detailed list of what I've done (most recently).

Results:
+ PG-driver is installed
+ Apache is serving me web pages
– I cannot SFTP anything into /var/www
– TileStache tests all return 500 Internal Server Error

So close… but yet so far…

# from a clean install of Ubuntu-Server
sudo aptitude update
sudo aptitude upgrade

# install prerequisites
sudo aptitude install build-essential checkinstall postgresql \
  postgresql-server-dev-9.1 libjson0-dev libxml2-dev libproj-dev \
  python2.7-dev swig

cd ~
mkdir -p src

# download and compile geos
cd ~/src/
wget http://download.osgeo.org/geos/geos-3.3.5.tar.bz2
tar -xvjf geos-3.3.5.tar.bz2
cd geos-3.3.5
./configure --enable-python
make -j2
sudo checkinstall  # uninstall with: dpkg -r geos

# download and compile gdal
cd ~/src/
wget http://download.osgeo.org/gdal/gdal-1.9.1.tar.gz
tar -xvzf gdal-1.9.1.tar.gz
cd gdal-1.9.1/
./configure --with-geos=/usr/local/bin/geos-config \
  --with-pg=/usr/lib/postgresql/9.1/bin/pg_config --with-python
make -j2
sudo checkinstall  # uninstall with: dpkg -r gdal

cd /

sudo ldconfig

sudo -u postgres -iH

# create a user within the database
createuser -SdRP gisuser

# create a database
createdb -E UTF8 -O gisuser gis
exit

# configure access to our database

sudo nano /etc/postgresql/9.1/main/pg_hba.conf

# Scroll to bottom and change the words ident and md5 to “trust”

# restart the PostgreSQL Server
sudo /etc/init.d/postgresql start

# install Apache, MySQL, and PHP
sudo tasksel install lamp-server

# ensure add-apt-repository is installed
sudo apt-get install -y python-software-properties

# install Mapnik 2.0
sudo add-apt-repository ppa:mapnik/v2.0.2
sudo apt-get update
sudo apt-get install libmapnik mapnik-utils python-mapnik

# Now to install TileStache. First some dependencies...

# install mod_python which TileStache will use to communicate
# with the web server
sudo apt-get install libapache2-mod-python

# restart the web server
sudo /etc/init.d/apache2 restart

# install packages Curl and Git
sudo apt-get install curl
sudo apt-get install git-core

# install some required python tools and libraries
sudo apt-get install python-setuptools
sudo aptitude install python-dev
sudo apt-get install libjpeg8 libjpeg62-dev libfreetype6 libfreetype6-dev

# install PIP to easily install python modules
sudo curl -O https://raw.github.com/pypa/pip/master/contrib/get-pip.py
sudo python get-pip.py

# install the required python modules
sudo pip install -U werkzeug
sudo pip install -U simplejson
sudo pip install -U modestmaps

# PIL has some quirks in Ubuntu 11.10 so we need to do some quick fixes
sudo ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib
sudo ln -s /usr/lib/x86_64-linux-gnu/libfreetype.so /usr/lib
sudo ln -s /usr/lib/x86_64-linux-gnu/libz.so /usr/lib

sudo pip install -U pil

# download TileStache from GitHub
sudo git clone https://github.com/migurski/TileStache.git

# run the install script
cd TileStache/
sudo python setup.py install

# add the mod_python configuration to tell our web server
# which URLs to have TileStache process
sudo nano /etc/apache2/httpd.conf

# and add this:

<Directory /var/www/tiles>
  AddHandler mod_python .py
  PythonHandler TileStache::modpythonHandler
  PythonOption config /TileStache/tilestache.cfg
</Directory>

# will direct any web traffic to the “tiles” folder
# containing the file extension “.py” to TileStache

# need to add a tiles directory to the web directory
sudo mkdir /var/www/tiles

# install OpenSSH
sudo apt-get install openssh-client
sudo apt-get install openssh-server

# to allow established connections to continue to function
sudo iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

# to allow SSH traffic
sudo iptables -A INPUT -p tcp --dport 22 -j ACCEPT

# to allow HTTP traffic
sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT

# to allow HTTPS traffic
sudo iptables -A INPUT -p tcp --dport 443 -j ACCEPT

# to allow remote database connections
sudo iptables -A INPUT -p tcp --dport 5432 -j ACCEPT

# drop all remaining traffic
sudo iptables -A INPUT -j DROP

# save all the rules to a file
sudo iptables-save > /etc/iptables.rules

# add the rules to the network adapter by editing the interfaces file
sudo nano /etc/network/interfaces

# just after iface eth0 inet static, add the following
# and make sure it is indented like the other lines

pre-up iptables-restore < /etc/iptables.rules

# reboot
sudo reboot

# if you don't know your ip address or server address, get your ip
ifconfig | grep inet

# Testing Your Server

# in a browser, go to:
 http://YOUR.IP.ADDRESS/tiles/tiles.py/osm/preview.html

# get an individual tile:
 http://YOUR.IP.ADDRESS/tiles/tiles.py/osm/16/18184/27794.png

# test that tileStache and Mapnik are working together:
 http://YOUR.IP.ADDRESS/tiles/tiles.py/example/preview.html


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Todd Albert  
View profile  
 More options Aug 26 2012, 11:14 am
From: Todd Albert <toddalb...@gmail.com>
Date: Sun, 26 Aug 2012 08:14:01 -0700 (PDT)
Local: Sun, Aug 26 2012 11:14 am
Subject: Re: [tilestache] TileStach.vector PostGIS/ GeoJSON

Mike,

Several more problems solved. Another problem encountered.

I figured out one issue from my apache error.log:

[Sat Aug 25 21:55:08 2012] [error] [client 192.168.37.1] AttributeError:
module '/usr/local/lib/python2.7/dist-packages/TileStache/__init__.pyc'
contains no 'ModpythonHandler'

It seems that I had accidentally capitalized the M in what should have been
'modpythonHandler' in my httpd.conf file!

I've now managed to get TileStache working again with .json files.

At first, it is still was not able to connect to the database. I tweaked
some permissions and modified the database, and now I can connect to the
database from Python using the script you provided. But since I didn't
modify any prefixes, I just used:

>>> from osgeo import ogr
>>> driver = ogr.GetDriverByName('PostgreSQL')
>>> src_name = "PG:dbname='gis' user='gisuser'"
>>> datasource = driver.Open(src_name)
>>> assert datasource

And no errors! Hallelujah!!

So, I fired up my browser and pointed to a vector tile that I've defined:
    http://192.168.37.131/tiles/tiles.py/parcels2/16/18185/27794.geojson
And I get the error:

  Known unknown!
  Couldn't get a layer from data source PG:dbname='gis' user='gisuser'

So, do I perhaps now have my database setup incorrectly? I can generate a
.geojson tile from a .json file, but so far have not been able to from the
database. I imported my data into the database from a .shp file. The same
.shp file that I used to create the .json file that is working.

Two steps forward, one step back… but I feel like I am really close. Still…

Thanks,
Todd


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Todd Albert  
View profile  
 More options Aug 26 2012, 11:20 am
From: Todd Albert <to...@me.com>
Date: Sun, 26 Aug 2012 11:20:11 -0400
Local: Sun, Aug 26 2012 11:20 am
Subject: Re: [tilestache] TileStach.vector PostGIS/ GeoJSON

How can I assure that my data are formatted / stored properly in the database?

Spatial queries seem to work.

Is there a special format that TileStache is expecting?

–Todd

On Aug 26, 2012, at 11:14 AM, Todd Albert <toddalb...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Todd Albert  
View profile  
 More options Aug 26 2012, 12:37 pm
From: Todd Albert <to...@me.com>
Date: Sun, 26 Aug 2012 12:37:54 -0400
Local: Sun, Aug 26 2012 12:37 pm
Subject: Re: [tilestache] TileStach.vector PostGIS/ GeoJSON

Grr…

I went back and recreated the database, redid my shp2pgsql command with the original shapefile, and re-imported the data into PostGIS.

I still get the error:

Known unknown!
Couldn't get a layer from data source PG:dbname='gis' user='gisuser'
Nothing valuable appears in the apache logs this time…

–Todd


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Todd Albert  
View profile  
 More options Aug 26 2012, 2:34 pm
From: Todd Albert <to...@me.com>
Date: Sun, 26 Aug 2012 14:34:35 -0400
Local: Sun, Aug 26 2012 2:34 pm
Subject: Re: [tilestache] TileStach.vector PostGIS/ GeoJSON

Mike,

Ok, I'm making good progress here…

I had to go into the PostGIS database and manually insert my SRID into the geometry_columns table. It had my SRID as -1 instead of 2236. I updated that.

Now when I visit http://192.168.37.131/tiles/tiles.py/parcels2/16/18185/27794.geojson it actually serves a tile instead of an error!

But, just when I thought I had things going well, I look at the .geojson file that it server and I see:
{"type": "FeatureCollection", "features": []}

It's empty!

So, I looked at my geography_columns table and it is empty. It has columns, but there are 0 rows.

Do I need the geography_columns to be defined for my table?

What am I doing wrong here?!

On Aug 26, 2012, at 12:37 PM, Todd Albert <to...@me.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Todd Albert  
View profile  
 More options Aug 26 2012, 4:13 pm
From: Todd Albert <toddalb...@gmail.com>
Date: Sun, 26 Aug 2012 13:13:10 -0700 (PDT)
Local: Sun, Aug 26 2012 4:13 pm
Subject: Re: [tilestache] TileStach.vector PostGIS/ GeoJSON

Here's what I tried –

I reprojected the data into Google's Spherical Mercator projection
(SRID=900913)
   sudo ogr2ogr re_Parcels_3.shp Parcels_3.shp -t_srs EPSG:900913

I verified that this worked
   ogrinfo re_Parcels_3.shp -al -so

...
Layer SRS WKT:
PROJCS["Google_Maps_Global_Mercator",
    GEOGCS["GCS_WGS_1984",
        DATUM["WGS_1984",
            SPHEROID["WGS_1984",6378137,298.257223563]],
        PRIMEM["Greenwich",0],
        UNIT["Degree",0.017453292519943295]],
    PROJECTION["Mercator_2SP"],
    PARAMETER["standard_parallel_1",0],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",0],
    PARAMETER["false_easting",0],
    PARAMETER["false_northing",0],
    UNIT["Meter",1]]
...

I then imported this data into the database
   shp2pgsql re_Parcels_3.shp > re_Parcels_3.sql
   psql -d gis -U gisuser -f re_Parcels_3.sql

And updated the geometry_columns table to associate the new SRID with the
new table.

Of course I had to update my tilestache.cfg to point to the new table.

And still, I'm getting blank tiles.
   {"type": "FeatureCollection", "features": []}

When I point to the layer that points directly to the .json sample file, I
get a bunch of features

{"type": "FeatureCollection", "features": [{"geometry": {"type": "Polygon", "coordinates": [[[-80.107558, 26.338201], [-80.10732, 26.338201], [-80.10732, 26.337898], [-80.107558, 26.337898], [-80.107558, 26.338201]]]}, "type": "Feature", "properties": {"PARID": "06424725140260280"}}, {"geometry": {"type": "Polygon", "coordinates": [[[-80.111183, 26.340753], [-80.110847, 26.340758], [-80.110843, 26.340552], [-80.111179, 26.340546], [-80.111183, 26.340753]]]}, "type": "Feature", "properties": {"PARID": "06424725220550240"}}, {"geometry": {"type": "Polygon", "coordinates": [[[-80.11199, 26.339854], [-80.111654, 26.339859], [-80.11165, 26.339653], [-80.111986, 26.339648], [-80.11199, 26.339854]]]}, "type": "Feature", "properties": {"PARID": "06424725220540190"}}, {"geometry": {"type": "Polygon", "coordinates": [[[-80.108286, 26.339245], [-80.108051, 26.339246], [-80.10805, 26.338943], [-80.108285, 26.338943], [-80.108286, 26.339245]]]}, "type": "Feature", "properties": {"PARID": "06424725140250120"}}, {"geometry": {"type": "Polygon", "coordinates": [[[-80.111491, 26.339303], [-80.111155, 26.339309], [-80.111151, 26.339102], [-80.111487, 26.339097], [-80.111491, 26.339303]]]}, "type": "Feature", "properties": {"PARID": "06424725220550120"}}, {"geometry": {"type": "Polygon", "coordinates": [[[-80.107223, 26.339686], [-80.106994, 26.339686], [-80.106994, 26.339384], [-80.107223, 26.339384], [-80.107223, 26.339686]]]}, "type": "Feature", "properties": {"PARID": "06424725140240190"}}, {"geometry": {"type": "Polygon", "coordinates": [[[-80.106935, 26.337761], [-80.10681152467893, 26.337761], [-80.10681152467893, 26.337729968444485], [-80.106935, 26.337729968444485], [-80.106935, …………

and on and on for pages…

I am running out of time to figure this out. We're on the threshold of switching to a commercial solution which is much less flexible.

Please help!

Desperately,

Todd


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michal Migurski  
View profile  
 More options Aug 26 2012, 11:05 pm
From: Michal Migurski <m...@stamen.com>
Date: Mon, 27 Aug 2012 04:05:09 +0100
Local: Sun, Aug 26 2012 11:05 pm
Subject: Re: [tilestache] TileStach.vector PostGIS/ GeoJSON
Well, my ability to help with your own database is fairly limited, but here's what I'd look out for:

1. The vector provider will try to figure out your layer's projection, but if it can't for some reason it will default back to plain geographic 4326, so to be on the safe side keep your database unprojected and in lat, lon:
        https://github.com/migurski/TileStache/blob/master/TileStache/Vector/...

2. I'm pretty sure you don't need anything in geography_columns, it's a new PostGIS 2.0-ism and I've never used it, but as I've said my experience with 2.0 is limited.

3. Can you make normal spatial queries of your table using psql itself for a given tile? You seem to have data in Florida, can you query for features within a known tile bounding box like 14/4546/6948 (http://teczno.com/s/yjh)?
        southwest:      26.33280        -80.11230       (geographic)
        northeast:      26.35249        -80.09033       (geographic)
        upper-left:     -8918061        3042804 (spherical mercator)
        lower-right:    -8915615        3040358 (spherical mercator)

4. If you need to see inside whatever Tilestache is doing, you can turn on logging output and modify the source code of TileStache/Vector/__init__.py to insert your own logging statements and watch your web server's log, wherever that goes:
        http://tilestache.org/doc/#logging

        # sample log code
        import logging; logging.debug('hello world')

Hope this helps!

-mike.

On Aug 26, 2012, at 9:13 PM, Todd Albert wrote:

----------------------------------------------------------------
michal migurski- m...@stamen.com
                 415.558.1610

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Messages 1 - 25 of 36   Newer >
« Back to Discussions « Newer topic     Older topic »