[postgis-devel] Help with GPS Coord in PostGIS

Chris Hodgson chodgson at refractions.net
Thu May 11 12:18:41 PDT 2006


This would probably get more replies on the user list, but... I have a 
few suggestions for you.

1) check your spatial_ref_sys table, the srid you are using should be in 
that table corresponding to the correct srtext and proj4text values. If 
your spatial_ref_sys table is empty, then load the spatial_ref_sys.sql 
file that came with postgis.

2) put a projection definition in your mapfile which corresponds to your 
projection

3) your query for inserting the geometries is missing "setsrid()" but 
supplies the srid ... I'm guessing that's a cut/paste typo in the 
e-mail, because otherwise your query would probably fail

4) I don't know what makeline does, but it looks like a compound 
function that puts points together into a line? I don't know how that 
could work since they would need to be ordered somehow... plus you don't 
have a "group by" clause so there is nothing to be compounded, unless I 
guess your are putting the entire table together... basically, if the 
query inside the paretheses doesn't work in your psql, it's not going to 
work for mapserver either...ie. does this query succeed?

select makeline(the_geom),1 as gid from gps_coord


Even if it does, work, you might need to rename the geom column to 
something else like:

DATA new_geom from (select makeline(the_geom) as new_geom, 1 as gid from 
gps_coord) USING ...

5) If what you want is to just show the whole path then maybe you should 
just load a single linestring geometry instead of a bunch of points? SO 
use perl or whatever scripting language you like to parse your input 
file into one big insert statement for just a single row with a single 
linestring geometry. Or, if your path is quite long, then insert a bunch 
of linesegments, each N points long. I suppose you could do the same in 
sql instead of perl if you prefer, the general idea is just to make the 
linestring(s) first so that they are easier/faster/simpler to display 
(hopefully).

So, I hope something in there helps. If not, try on the users list.

Chris





More information about the postgis-devel mailing list