Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am using a PostGIS query to find the intersection of two streets, and then transform the results into lat/lon. The street database's current SRID is 6856, a projection I added to PostGIS myself; and the target SRID is 4326. For reasons unknown, the transformation is not working. Here is my original query, which produces a point in feet:

SELECT distinct(AsText(intersection(b.geom, a.geom))) AS the_intersection FROM (SELECT geom FROM public.streets WHERE streetname='LOVEJOY' AND prefix='NW' AND ftype='ST') a, (SELECT geom FROM public.streets WHERE streetname='23RD' AND prefix='NW' AND ftype='AVE') b WHERE a.geom && b.geom AND intersects (b.geom, a.geom);

And here is my modified query, in which I attempt to transform the feet to lat/lon:

SELECT distinct(AsText(ST_Transform(intersection(b.geom, a.geom),4326))) AS the_intersection FROM (SELECT geom FROM public.streets WHERE streetname='LOVEJOY' AND prefix='NW' AND ftype='ST') a, (SELECT geom FROM public.streets WHERE streetname='23RD' AND prefix='NW' AND ftype='AVE') b WHERE a.geom && b.geom AND intersects (b.geom, a.geom);

This is my error message:

ERROR:  AddToPROJ4SRSCache: could not parse proj4 string ''

I have verified that both 6856 and 4326 are available in my spatial_ref_sys. Any insights would be appreciated.

share|improve this question
2  
I don't see any EPSG:6856 SRS either in my PostGIS or on spatialreference.org. Maybe the proj4 string is indeed not formatted correctly? –  Micha Oct 28 '12 at 19:56
    
Dang, it's not. I used the PostGIS insert code from spatialreference.org, which for some reason has srtext but not proj4text: spatialreference.org/ref/sr-org/6856/postgis –  L_Holcombe Oct 28 '12 at 21:59

1 Answer 1

up vote 3 down vote accepted

Research indicates that this problem is caused by having an incorrect proj4 string in the proj4text field of the spatial_ref_sys table. I didn't think this was possible, because I got the PostGIS insert statement for this projection (6856) directly from spatialreference.org. But as you can see from the insert text, spatialreference.org provides srtext, but not proj4text. Updating the table with the correct proj4text should solve the problem.

And in the future, I shall be more watchful of the information I get from spatialreference.org.

http://spatialreference.org/ref/sr-org/6856/postgis/

share|improve this answer
    
The Fix: UPDATE spatial_ref_sys SET proj4text='+proj=lcc +lat_1=44.33333333333334 +lat_2=46.0 +lat_0=43.66666666666666 +lon_0=-120.5 +x_0=8202099.737532808 +y_0=0 +ellps=GRS80 +units=ft +to_meter=0.3048 +no_defs' WHERE srid=6856; The main difference between 6856 and EPSG:2838 is that 6856 uses international feet instead of meters. Also, for some reason, the reference parallels are switched. –  L_Holcombe Oct 28 '12 at 23:20
    
Nightmare! The false easting needs to be in meters, even if the projection units are feet. +x_0=2500000 –  L_Holcombe Oct 29 '12 at 0:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.