Color coding from two data sources
Don Drake
dondrake at GMAIL.COM
Wed Oct 17 10:41:54 PDT 2007
On 10/16/07, Mark Leslie <mark.leslie at lisasoft.com> wrote:
>
> Don Drake wrote:
> > On 10/16/07, Mark Leslie <mark.leslie at lisasoft.com> wrote:
> >> Don Drake wrote:
> >>> Here's my scenario, I have shapefiles containing polygons of
> >> zipcodes. I
> >>> have a table in Postgres that has a zip code with data that I would
> like
> >> to
> >>> thematically map. I am not interested in loading the zipcodes into
> >> PostGIS
> >>> if I don't have to. I am using PHP/Mapscript, and I was wondering if
> >> there
> >>> is a way to merge the Postgres data with the shapefile layer on a map?
> >>>
> >>> Thanks.
> >>>
> >>> -Don
> >>>
> >> That depends what you mean by 'merge'. If you want to display both in
> >> the same layer, you can come close by defining two layers in the same
> >> group (see the GROUP item at
> >> http://mapserver.gis.umn.edu/docs/reference/mapfile/layer). If you
> want
> >> to join the two sources together, Jeff has a nice example in the
> >> reference docs
> >> (
> >>
> http://mapserver.gis.umn.edu/docs/reference/mapfile/join#example-2-join-from-shp-file-to-postgresql-table
> >> ).
> >> If I've missed the point entirely, then I'll need some more details
> >> about what you're trying to end up with.
> >>
> >>
> >
> > Very interesting. It looks like the second link is close to what I
> need,
> > the first is not what I need.
> >
> > The thing is that the postgres table the data is coming out of does not
> have
> > a geometry column, the key is the zipcode. Furthermore, it will
> probably
> > come from a query, or a view. I tried using a view with no geometry and
> > could not get it to work. The geometry will come from a shapefile.
> >
> > If this would work, could I color code using an expression? Is there a
> > Mapscript alternative?
> >
> > Thanks.
> >
> > -Don
> >
>
> If there's no geometry in the table, then the join is your only option
> AFAIK. The downside is that joins are only intended for use in queries,
> not in styling. I expect that since you're using MapScript, you could
> execute a query to determine membership and dynamically setup the
> styling, but that's a reasonably horrible solution. You'd be better of
> using php to connect directly to postgres (http://au2.php.net/pgsql) to
> find a zipcodes and set up your classes from that. Can I ask why you
> don't want to load the zipcodes into PostGIS, or extract the table to
> shapefile for that matter? Does the zipcode table change frequently?
>
> --
> Mark Leslie
> Software Architect
> LISAsoft Pty Ltd
> www.lisasoft.com
>
Loading the zipcodes into PostGIS is just a pain quite honestly. They're
sitting in the filesystem for the entire country, I wish I could easily
change the polygon color based on another attribute from a query from
Postgres.
I tried doing that using expressions, but it's not working, debugging
mapscript is very frustrating.
I'll be loading these into postGIS, thanks for your help.
-Don
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20071017/b7ae1900/attachment.htm>
More information about the MapServer-users
mailing list