luke.bace (66) [Avatar] Offline
#1
Please post all errata here.
Greener (8) [Avatar] Offline
#2
Re: Errors and Corrections
In chapter 1, after importing the shapfile.

I added geom attribute based on the script below:
SELECT AddGeometryColumn('ch01', 'roads', 'geom', 2163, 'MULTILINESTRING',2);

Then....
The following script generates an error.
UPDATE ch01.roads
SET geom =
ST_Transform(geom_4269, 2163);
//-------------------------------------------------------------------
ERROR: Input geometry has unknown (-1) SRID
SQL state: XX000
//------------------------------------------------------------------
I am not sure why it is doing it.
SRID -> 2163 is valid
Any help would appreciate it.
Chris
regina.leo (234) [Avatar] Offline
#3
Re: Errors and Corrections
Check to make sure your geom_4269 has an SRID other than 0 or -1.

SELECT ST_SRID(geom_4269) from ch01.roads;

If it doesn't have a alid srid, then I think ST_Transform gives that error because it wouldn't know the formula to use to transform from unknown to 2163.

What command did you use to import the table or did you use the gui loader? Its possible you missed the -s 4269 switch or there is a bug in the loader version you have.

If that is the case, the easy remedy is to do this instead:

UPDATE ch01.roads
SET geom =
ST_Transform(ST_SetSRID(geom_4269,4269), 2163);
regina.leo (234) [Avatar] Offline
#4
Re: Errors and Corrections
slight correction:

SELECT DISTINCT ST_SRID(geom_4269) from ch01.roads;
Greener (8) [Avatar] Offline
#5
Re: Errors and Corrections
Hello Regina,
I used to GUI PostGIS shapeloader tool.
You are correct that I had value -1.
I used your update sql and it worked.
I was able to perform the rest of other queries in the chapter 1.
Onto the chapter 2...
Excellent book; and very happy that you are present on the forum.

Thank you for your assistance.
Chris
Gyula_58 (13) [Avatar] Offline
#6
Re: Errors and Corrections
After the code in listing 5.12:

There are three import things about using DISTINCT ON.

maybe important?
regina.leo (234) [Avatar] Offline
#7
Re: Errors and Corrections
Thanks. -- that one slipped by too smilie
Gyula_58 (13) [Avatar] Offline
#8
Re: Errors and Corrections
Example in App.C.

SELECT c.city_name
FROM city As c
LEFT JOIN airports As a ON a.city_code=c.city_code
WHERE a.airport_code IS NULL;

text in bold is missing from the code
Gyula_58 (13) [Avatar] Offline
#9
Re: Errors and Corrections
Chapter 7.

ogr2ogr -f "MapInfo file" /gisdata/biketrip.tab PG:"host=localhost user=postgres port=5432 dbname=postgis_in_action password=mypassword" –select "SELECT track_seg_point_id, ele, time" -where "time BETWEEN '2009-07-18 04:33-04' AND '2009-07-18 04:34-04'" staging.aus_biketrip_narangba

SELECT in bold is needless and the same applies to the similar KML example as well.
After correcting the select surplus, the script was not still operating, I suppose because of the format of timestamps, but I did not have more time to play with it.
Gyula_58 (13) [Avatar] Offline
#10
Re: Errors and Corrections
Appendix C

SELECT p.product_name, s.state, p.base_price * (1 + s.tax) As total_price
FROM products AS p
CROSS JOIN state AS s;
-- 1 Can also be written as

SELECT p.product_name, s.state,p.base_price * (1 + s.tax) As total_price
FROM products AS p, state AS s

...added the part in bold still is necessary...
Gyula_58 (13) [Avatar] Offline
#11
Re: Errors and Corrections
Appendix C.

SELECT c.last_name, c.first_name, r.rental_id, p.amount, p.payment_date
FROM customer As C
INNER JOIN rental As r ON C.customer_id = r.customer_id
LEFT JOIN payment As p
ON (p.customer_id = r.customer_id AND p.rental_id r.customer_id);

Well, AND requires boolean data types on both sides.
I guess, neither p.rental_id nor r.customer_id are boolean values, so something must be missing here...
regina.leo (234) [Avatar] Offline
#12
Re: Errors and Corrections
Good catch. Thanks.
regina.leo (234) [Avatar] Offline
#13
Re: Errors and Corrections
We seem to have made the same mistake with the KML one.

Regarding the other issue you are having why its still not working. I'm afraid its the evils of MS Word at work. Somewhere along the line, I think it replaced our - with a smart dash and the " possibly with smart quotes.
Gyula_58 (13) [Avatar] Offline
#14
Re: Errors and Corrections
Appendix C.

SELECT n.nei_name,
SUM(ST_Length(road.the_geom)) as total_road_length,
ST_Extent(road.the_geom) As total_extent,
COUNT(DISTINCT road.road_name) As count_of_roads
FROM neighborhoods As n
INNER JOIN roads ON
ST_Intersects(neighborhoods.the_geom, roads.the_geom)
WHERE n.city = 'Boston'
GROUP BY n.nei_name
HAVING ST_Area(ST_Extent(road.the_geom)) > 1000;

the table names underlined in the code should be roads...
albickers (2) [Avatar] Offline
#15
Re: Errors and Corrections
3.3 (Using rules and triggers). Minor but...

The two mechanism for handling the conditional

Should be mechanisms
albickers (2) [Avatar] Offline
#16
Re: Errors and Corrections
Listing 4.1

Line 4: (ST_GeomFromText('POLYGON((10 28, 9 29, 7 30, 10 2smilie);

Is missing the terminating single quote on the text input to the function.

The same problem occurs in listing 4.2.

Message was edited by:
albickers
GDW62 (94) [Avatar] Offline
#17
Re: Errors and Corrections
On p75, in the following sentence:

"We now summarize the pros and cons of the homogenous columns approach:"

"homogenous" should be "homogeneous".
regina.leo (234) [Avatar] Offline
#18
Re: Errors and Corrections
Al,

Thanks. Looks like that error was already caught by our proof readers in our current version. Sadly this isn't on MEAP. Well hopefully the book should be do out within the next 2 weeks.
regina.leo (234) [Avatar] Offline
#19
Re: Errors and Corrections
Gary,
That error was caught too by proof readers. Thanks though - keep up the error hunting smilie
regina.leo (234) [Avatar] Offline
#20
Re: Errors and Corrections
These ones were caught too. Well its good to know that these have been fixed before print.
GDW62 (94) [Avatar] Offline
#21
Re: Errors and Corrections
The code that populates ch03.paris_hetero is duplicated for extracting from planet_osm_line and omits extraction from planet_osm_point. Also, the notes that accompany the code state "repeat for osm_polygon, osm_line -- not shown in book" which doesn't match what's in the book as the book shows extraction from planet_osm_line.

Gary
regina.leo (234) [Avatar] Offline
#22
Re: Errors and Corrections
Gary,

Thanks. Yap this one still seems to be an issue in the version we are looking at. we'll try to get it in before final print. Not sure how far along they are. But we are up to 3rd proof and I think in 4th proof they send to print.

We'll fix the code download too.

Thanks a bunch,
Leo and Regina
sabman (1) [Avatar] Offline
#23
Re: Errors and Corrections
Listing 3.1 Code to partition roads into various states
Chapter 3 Page 60

Before creating constraint (2) we need to have the state column in the roads table, otherwise the example doesn't work:

ALTER TABLE roads ADD COLUMN state varchar(2);
erilem (1) [Avatar] Offline
#24
Re: Errors and Corrections
Chapter 5 Section 5.5.3. The description of of Listing 5.8 is incorrect. "It will return the top five closest roads for each location of interest that are within 20 kilometers" to be replaced with "It will return the top two closest roads for each location of interest that are within one kilometer".
thomie (1) [Avatar] Offline
#25
Re: Errors and Corrections
Listing 4.7 ST_Box2D and casting a box to a geometry

CAST(ST_Box2D(geom) As geometry)
griffilo (2) [Avatar] Offline
#26
Re: Errors and Corrections
I've been working through slowly and think I've found a few problems:

1. There is a general inconsistency in the use of "highways" or "roads" as the shape table name. The code which is downloaded separately uses "roads" but the pdf uses "highways", except for analysing statistics and some of the queries (listing 1.6, and first query in 1.4.5), where it refers to roads.

Also,

2. Listing 1.6 refers to f.franchise_code and f.franchise_name, but these are earlier set up as id and franchise.
griffilo (2) [Avatar] Offline
#27
Re: Errors and Corrections
It's possible I've messed something up, but I get NO Hardees restaurants when I run the code:

SELECT COUNT(DISTINCT r.id) As total
FROM ch01.restaurants As r
INNER JOIN ch01.roads As h
ON ST_DWithin(r.geom, h.geom, 1609*10)
WHERE r.franchise = 'HDE'
AND h.name = 'US Route 1' AND h.state = 'MD';

I do get the following results if I leave out the franchise clause and do a group by on franchise:

total | franchise
-------+-----------
36 | BKG
27 | KFC
61 | MCD
17 | PZH
17 | TCB
20 | WDY