The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

In the EAP PDF, version 2, the command in section 4.3.2 (very end of page 109):

raster2pgsql -s 4326 -C usgs_srtmN48E086.hgt staging.n48e086 | psql -h localhost -U postgres -p 5437 -d postgis_in_action

is missing a path separator. The command should be, for Linux:

raster2pgsql -s 4326 -C usgs_srtm/N48E086.hgt staging.n48e086 | psql -h localhost -U postgres -p 5437 -d postgis_in_action

or for Windows:

raster2pgsql -s 4326 -C usgs_srtmN48E086.hgt staging.n48e086 | psql -h localhost -U postgres -p 5437 -d postgis_in_action

Also note that the use of port 5437, rather than the usual 5432 is very surprising. The text doesn't explain why we might be using a different port from other examples.

Message was edited by:
dconger
The select statement on pages 109-110 in version 2 of the PDF returns no rows. Specifically, the proj4text column for the row having srid value 4269 does not contain the string "nad83," so the where clause condition "proj4text ILIKE '%nad83%'" excludes that row.

I see that I get the correct row if I replace that clause with "srtext ILIKE '%nad83%'" however I get back four additional rows, too.

The query at the bottom of page 110 returns no rows for the same reason.

Oh, this is with PostGIS 2.0.1 installed as part of OpenGeo suite 3.0.1. Furthermore, in the source code download for PostGIS 2.0.3, the file spatial_ref_sys.sql does not insert '+datum=NAD83' into proj4text in any row as far as I can tell.

Message was edited by:
dconger
Added mention of second query on pg. 110 and spatial_ref_sys.sql.
The link to the file statesp020.tar.gz is broken in section 3.3.1, page 108 of version 2 of the PDF. A bit of poking around suggests that the current link might be http://dds.cr.usgs.gov/pub/data/nationalatlas/statesp020_nt00032.tar.gz.

Also note that the text says "Earlier in this chapter, we downloaded the file..." but this is actually the first reference to it.
Listing 2.10 creates a raster table with a width of 90 and a height of 60, i.e., "ST_MakeEmptyRaster(90, 60 --," but the text that follows (on page 74 of version 2 of the PDF) refers the table as having dimensions 90 by 45.

The query output on page 75 correctly shows the value of column "by" as 60.

Noted that sample output on following page was correct.
Message was edited by:
dconger
The fourth and fifth bullet points in section 2.1.5, page 52 of PDF version 2, are almost identical paragraphs. (The fifth bullet point has a little extra text at the end of the last sentence.)
Listing 1.6 under section 1.4.4 (page 26 of the PDF) includes a join on "r.franchise = f.franchise_code" and makes two references to f.franchise_name. However, the lu_franchise table is set up in listing 1.2 to use the column names "id" and "franchise." (And as I saw mentioned here on the forum already, ch01.roads should be ch01.highways.)

So the correct query appears to be:

SELECT f.franchise
, COUNT(DISTINCT r.id) As total
FROM ch01.restaurants As r
INNER JOIN ch01.lu_franchises As f ON r.franchise = f.id
INNER JOIN ch01.highways As h ON ST_DWithin(r.geom, h.geom, 1609)
GROUP BY f.franchise
ORDER BY total DESC;