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.

shp2pgsql-gui is not apparently available as a plugin in a default windows install. I have no plugins installed by default for pgAdmin III.

Thus the instructions:

Using pgAdmin III, we first highlight the database and then fire up shp2pgsql-gui using the plug-in menu or button. See figure 1.4.

didn't work for me.

Luckily, I found shp2pgsql-gui.exe in an executable file on my windows install.

Also note: Figure 1.4 is a bit small and fuzzy, and hard to read.
I can tell that the text says to change the name to: highways_staging, while the graphic itself shows the word "roads."

I also suggest specifically mentioning (not just in the graphic) to change the schema to ch01. I foolishly lost about an hour looking for the table the first time I imported it, because it landed in 'public' and I didn't see it there. I'm sure I wouldn't have missed it, though, if it was mentioned in the text.

(I'm still not sure of what schema are... but perhaps all will be revealed as I progress.)

I feel lucky to know that fk = foreign key, and lu probably means lookup. but it would be helpful if those, along with pk and fki prepended characters (and any others you might use in the book) were explained.

The original ALTER TABLE PostgresSQLdocs don't make very clear what FOREIGN KEY or REFERENCES means, though they do provide this example without explanation:
ALTER TABLE distributors ADD CONSTRAINT distfk FOREIGN KEY (address) REFERENCES addresses (address);

Likewise your book offers a short blurb for the following on PDF pages 24 and 25 (book pages 21 and 22)

ALTER TABLE ch01.restaurants
ADD CONSTRAINT fk_restaurants_lu_franchises
FOREIGN KEY (franchise)
REFERENCES ch01.lu_franchises (id)

I wish that were spelled out in a bit more detail. I think I'm finally getting the sense of that last line: that it refers to two groups of things: (on update cascade) (on delete restrict). I found it a bit confusing when you wrote on PDF pg 23/book page 21:

Maybe that line should say Adding UPDATE and DELETE rules when we add foreign key relationships will allow us to change the franchise id for our franchises if we want and have those update the restaurants table automatically. An example of an UPDATE rule is: ON UPDATE CASCADE. An example of a DELETE rule is ON DELETE RESTRICT.

(Am I saying that properly?)

In any case, I'd never have known how to write your ALTER command based on
so I'm glad you're including it in the book! Just wish there were a bit more documentation to explain it.

One more thought: judging by the docs page, would it make more sense if the example said:
ADD CONSTRAINT fk_restaurants_lu_franchises FOREIGN KEY (franchise) REFERENCES ch01.lu_franchises (id)
rather than splitting that across three lines?
I'm on Windows, and I installed PgAdmin III. I chose the Execute Arbitrary SQL queries button, which brought up the Query window. I entered


and received this error:

********** Error **********

ERROR: CREATE DATABASE cannot be executed from a function or multi-command string
SQL state: 25001

What do I need to do to make this work?

I just figured it out! I right-clicked on schema in pgAdmin III

Since we're encouraged to use this pgAdmin tool, it might be helpful to spell that out.

(Since the book guided us to enter CREATE SCHEMA ch01, I still wonder what I'm missing, in terms of where to enter that command.)
bottom of page 17
Missing s,
One for each of the color of the RGBA color space.

should be
One for each of the colors...

Page 18 (21 in PDF)
Change 'corn field' to 'cornfield'
cornfield is one word

change: "the US and Mexico" to either
"US and Mexico" or "the United States and Mexico"

change "Modelling" to
Double-l is British spelling, not consistent with the word "color" using US spelling. Actually, also not consistent with "modeling" used several pages later.


Pg. 19/22
No need to use a word like "perigee," that most of your readers won't know. (I know I had to look it up, which was distracting).

pg 28 (PDF)
postgis_in_action_2e ---> postgis_in_action
(we've been asked to create a database named postgis_in_action throughout the rest of the book.

pg 29 (PDF)
"How many fast-food restaurants are within one mile of a highway?." Remove the period. The question mark is sufficient. Also, "Alas" seems like not-quite-the-right word. I suggest leaving it out.
f.franchise_name --> f.franchise
f.franchise_code -->
ch01.roads --> ch01.highways

To only count each resturant once, in (1) we used the
COUNT(DISTINCT) construct to ensure we count each restaurant only once.
Change to:
To ensure that we count each restaurant only once, we used the COUNT(DISTINCT) construct.

(remove duplicate "count each restaurant..." and correct spelling of 'restaurant')


pg 30,31,32
fix dwithin to 18, per Patrick's post:
Also, fix image. My restaurants came in south of the selected highway, not to the east, as shown.

(Also, can you further explain the SQL on the bottom of pg PDF-31. I don't find it to be intuitive SQL. It would be helpful if each complex sql statement were also described in the form of an English sentence. I can clearly see that it works... I just can't quite figure out why.)
"geography" and "topology" appear twice in the list of Index Terms.


We’ll refer to these as a spatial catalog and are similar in concept to the standard information_schema catalog
tables you’ll find in PostgreSQL proper...

I think this sentence has a grammar issue. I'd split it into two: "We'll refer to these as a spatial catalog; They are similar in concept to..."

Otherwise, the "are similar" seems to apply to "we."
up to date--> up-to-date
"Spatial columns versus layers"
If they are often referred to as synonyms, perhaps this shouldn't be titled "versus." replace "versus" with "and"
Regardless what spatial types you use--> Regardless of what spatial types you use
subclassfications ---> subclassifications
It's subtype --> Its subtype
(See: )
PDF-38 creates a table called my_points. PDF-39 alters a table called my_geometries (which doesn't actually exist). I think the one on pg. 38 should be renamed my_geometries.
[Actually, this item is currently a barrier. I can't seem to figure out how not to get error messages, no matter what I try, including creating a new table called my_geometries]
UPDATE: I was able to alter the my_geometries table upon creating a field called Name. We hadn't yet learned about postgresql text types, so first I tried "char" and discovered that was only 1 character. So, after a good deal of manipulation, and creation of a 25-character field, I was able to get past this erratum.
throughout chapter 2 code listings, be sure to prepend table names with schema "ch02."
"Listing 2.3 demonstrates exterior ring forming a solid polygon whose exterior created from the closed linestring we defined in listing 2.2."
1) "whose exterior created from" --> "whose exterior was created from"
2) It doesn't seem that this was actually created from the prior listing content. Seems it's generating values anew, directly from the typed text in 2.3. Is the following more accurate? "Listing 2.3 demonstrates forming a solid polygon whose exterior matches the closed linestring we defined in 2.2"
For a 3DM multipoints,--> For a 3DM multipoint
not an error, just a suggestion: Clarify that "with or without a space" refers (I think?) to to the space after the word "MULTIPOINT."
is more in line with [how] other spatial relational databases,--> remove "how"
"The following examples of multilinestring are shown..."
Set "multilinestring" in Courier font.)
not necessary, but I'd expect "Figure" to be capitalized.
Might be helpful if Figure 2.8 matched the three MULTILINESTRINGs described.

"you'd either have to resort to some convention to tag the missing data."
(expecting an "or" because of the "either.")
"All PostGIS functions that take M coordinates into consideration assumes"
(Change "assumes" to "assume")

Listing 2.6 Forming geometrycollectionms from constituent geometries
(remove extraneous "m")
(Is it intentional to include listing 2.6? It seems quite similar to listing 2.5. If both are important, it would be helpful to the reader to distinguish the two.)
"Aeronautical charts are full of them because the sweep of radar is circular."
(Best to change "them" to "curved geometries" because this sentence appears immediately after one saying "for many modeling cases, these structures can be adequately approximated with lines."
"Curved subtypes are not suppported in the geography data type." (remove extra "p" in "supported")
ALTER TABLE my_geometries
ADD COLUMN ch02.my_circular_strings geometry(CIRCULARSTRING);
(Move "ch02." to prepend "my_geometries." Remove from ADD COLUMN statement.)
For all the illustrations based on converting to geometries from text, it would be helpful if the figures included a grid, and labeled points.
(remove capitalization from the letter "H")
(near the middle of the second paragraph, beginning of the line.)
colums -->columns
(near end of first paragraph)
"If you don’t the record in geometry_columns"
(Add comma after "don't")
"Another pre-2.0 headache when adding new column"
(change to either "when adding a new column" or "when adding new columns" per your preference.)

Message was edited by: