[postgis-users] Display & Print Methods For PostGIS

Mark Fenbers Mark.Fenbers at noaa.gov
Sun May 24 04:26:29 PDT 2009


adam at spatialsystems.org wrote:
> I have about 3,000,000 data points in a PostGIS DB that have speed
> measurements associated.  The measurements were taken every second and I
> bin the measurements by snapping to a several hundred meter grid to
> limit the number of data points.
>
> My question is:  What method would I use to create a PDF map from
> PostGIS?  I'll likely get the roads out of PostGIS from a stored
> shapefile.
>
> How I bin....
> SELECT
> X(binned_speed_data.grid) AS x,
> Y(binned_speed_data.grid) AS y,
> max(binned_speed_data.speed::double precision ) as max_speed,
> avg(binned_speed_data.speed::double precision ) AS avg_speed,
> min(binned_speed_data.speed::double precision ) AS min_speed,
> count(binned_speed_data.speed) AS speed_count
> FROM
> (
> SELECT
> SnapToGrid(speed_data.location, 0.001) AS grid,
> speed_data.speed as speed
> FROM
> speed_data
> WHERE
> speed_data.id = 3
> ) AS binned_speed_data
> GROUP BY
> x,
> y
>   
Now you feed your output from this query into your GIS software and 
create a map that way (then export to PDF).  You'll probably want to use 
a GIS package (like GMT or GRASS) that can be completely command-line 
(script) driven...

That's how I do similar things, but I am curious if others have more 
clever ideas...

Mark



More information about the postgis-users mailing list