[postgis-users] Holy cow are linestrings a problem

Per-Olof Norén pelle at alma.nu
Thu Nov 29 01:20:03 PST 2007


phat-ass at thinkheavyindustries.com skrev:
> I've got geoserver up and running, and it's nice.
>
> I've got postgis talking to geoserver and that's nice.
>
> What I need to do is collect this awful .shp file of linestrings into something I can display properly. I can't seem to figure out the syntax for this.
>
> I'm lost in the world of duplicate labels! 
>
>   
Assuming you want to aggregate geometries based on a label column, you'd 
be using a group by based aproach in conjunction with the st_union 
functions.

example:
create table testdata (
    id serial primary key,
    label varchar(255),
    the_geom geometry -- created using addgeometrycolumn
);


select
   label,
   st_union(the_geom)
from
   testdata
group by
   label;

OR:

you could play with a custom SLD in geoserver containing a 
Textsymbolizer, naturally:

 <TextSymbolizer>
      ....
      <VendorOption name="group">yes</VendorOption>
</TextSymbolizer>

Grouping tries to reduce the number of times a label is written.
I'd suggest that you further consult at the geoserver-users mail list 
regarding the SLD.

cheers,
Per-Olof




More information about the postgis-users mailing list