<br><br><div><span class="gmail_quote">On 10/16/07, <b class="gmail_sendername">Mark Leslie</b> <<a href="mailto:mark.leslie@lisasoft.com">mark.leslie@lisasoft.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Don Drake wrote:<br>> On 10/16/07, Mark Leslie <<a href="mailto:mark.leslie@lisasoft.com">mark.leslie@lisasoft.com</a>> wrote:<br>>> Don Drake wrote:<br>>>> Here's my scenario, I have shapefiles containing polygons of
<br>>> zipcodes. I<br>>>> have a table in Postgres that has a zip code with data that I would like<br>>> to<br>>>> thematically map. I am not interested in loading the zipcodes into<br>>> PostGIS
<br>>>> if I don't have to. I am using PHP/Mapscript, and I was wondering if<br>>> there<br>>>> is a way to merge the Postgres data with the shapefile layer on a map?<br>>>><br>>>> Thanks.
<br>>>><br>>>> -Don<br>>>><br>>> That depends what you mean by 'merge'. If you want to display both in<br>>> the same layer, you can come close by defining two layers in the same
<br>>> group (see the GROUP item at<br>>> <a href="http://mapserver.gis.umn.edu/docs/reference/mapfile/layer">http://mapserver.gis.umn.edu/docs/reference/mapfile/layer</a>). If you want<br>>> to join the two sources together, Jeff has a nice example in the
<br>>> reference docs<br>>> (<br>>> <a href="http://mapserver.gis.umn.edu/docs/reference/mapfile/join#example-2-join-from-shp-file-to-postgresql-table">http://mapserver.gis.umn.edu/docs/reference/mapfile/join#example-2-join-from-shp-file-to-postgresql-table
</a><br>>> ).<br>>> If I've missed the point entirely, then I'll need some more details<br>>> about what you're trying to end up with.<br>>><br>>><br>><br>> Very interesting. It looks like the second link is close to what I need,
<br>> the first is not what I need.<br>><br>> The thing is that the postgres table the data is coming out of does not have<br>> a geometry column, the key is the zipcode. Furthermore, it will probably<br>> come from a query, or a view. I tried using a view with no geometry and
<br>> could not get it to work. The geometry will come from a shapefile.<br>><br>> If this would work, could I color code using an expression? Is there a<br>> Mapscript alternative?<br>><br>> Thanks.<br>
><br>> -Don<br>><br><br>If there's no geometry in the table, then the join is your only option<br>AFAIK. The downside is that joins are only intended for use in queries,<br>not in styling. I expect that since you're using MapScript, you could
<br>execute a query to determine membership and dynamically setup the<br>styling, but that's a reasonably horrible solution. You'd be better of<br>using php to connect directly to postgres (<a href="http://au2.php.net/pgsql">
http://au2.php.net/pgsql</a>) to<br>find a zipcodes and set up your classes from that. Can I ask why you<br>don't want to load the zipcodes into PostGIS, or extract the table to<br>shapefile for that matter? Does the zipcode table change frequently?
<br><br>--<br>Mark Leslie<br>Software Architect<br>LISAsoft Pty Ltd<br><a href="http://www.lisasoft.com">www.lisasoft.com</a><br></blockquote></div><br>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.
<br><br>I tried doing that using expressions, but it's not working, debugging mapscript is very frustrating.<br><br>I'll be loading these into postGIS, thanks for your help.<br><br>-Don<br>