consolidation of .map file contents

Ed McNierney ed at TOPOZONE.COM
Wed Apr 20 19:44:00 EDT 2005


Dylan -

Steve's suggestions are quite reasonable.  As he mentioned, I use the C
preprocessor to manage the generation of .map files.  The use of #define
and #include directives is especially helpful when you have a large
number of attributes you want to keep consistent across layers.  For
example, I might have a "street map" that's made up of several different
LAYERs (interstate highways, state highways, local roads, etc., etc.).
Each of them might have labels using fonts of a particular style and
size.  If I use a statement like:

        #define STREETFACE "Arial"
        #define STREETSIZE 10

Then it's easy for me to change the typeface or size of all those layers
at once, keeping them consistent.

        - Ed

Ed McNierney
President and Chief Mapmaker
TopoZone.com / Maps a la carte, Inc.
73 Princeton Street, Suite 305
North Chelmsford, MA  01863
Phone: +1 (978) 251-4242
Fax: +1 (978) 251-1396
ed at topozone.com 

-----Original Message-----
From: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU] On
Behalf Of Stephen Woodbridge
Sent: Wednesday, April 20, 2005 5:39 PM
To: MAPSERVER-USERS at LISTS.UMN.EDU
Subject: Re: [UMN_MAPSERVER-USERS] consolidation of .map file contents

Dylan Beaudette wrote:
> Steve,
>
> Thanks for the input. To clarify a bit, we have county -by-county 
> information, with associated data in a MySQL database that is accessed

> via Mapserver-style query templates and PHP.
>
> There are 2 current reasons why each county has its own .map file (and

> they might not even be very good ones, i hope!):
>
> 1. each map obviously has a different:
> -context map image
> -geographic extent
> -shape file for the main content, rendered according to the county

One question is why not make all your counties as a seamless map using a
tileindex. I have 3300+ counties of Tiger data and each county is a
directory of about 10 separate shapefiles for each of the layers. You
can do the same for images depending on projection issues.

http://imaptools.com/tiger/
http://imaptools.com/tiger2/ (Googlesque styling)

You may have reasons why you don't what to tile the counties, and you
could change the shapefile on the fly using mapscript.

As for geographic extents, you already have a way to select the county,
it would be pretty straight forward to load the extents of each county
into a table and then look up the extents after the county has been
selected and then position the map based on those extents.

Create a table like:

County_ID | State | County_Name | Shapefile | minx | miny | maxx | maxy

> 2. the query results need to contain a unique county ID
>
> a lot of these problems could be resolved if i could figure out how to

> pass mapserver configuration parameters in the URL: i.e. the county 
> ID, the geographic extent, and the name of the shape file containing 
> the main content for that county.

You can edit most stuff in the mapfile via the URL. If you had the table
of extents you could add the county ID, all my Tiger county polygons
have a unique FIPS id like 25017 for Middlesex County, MA. The 25 is
actually the FIPS code for MA. Do you have anything like that in the
shapefile attributes?

> does this seem reasonable?

It all sounds very reasonable, and if you are using mapscript then it
should be all the more easy to do these things. In mapscript if you
didn't want your counties tiled, then you could change the shapefile in
mapscript based on the county you selected.

There should be example around for most of the pieces mentioned above.
Ask the list for any specific issues and I'm sure you'll get the help
you need.

-Steve W.

> thanks!
>
> --
> Dylan Beaudette
> Soils and Biogeochemistry Graduate Group University of California at 
> Davis
> 530.754.7341
>
> On Wednesday 20 April 2005 11:47 am, Stephen Woodbridge wrote:
>
>>All of your ideas are valid and can work depending on what you are try

>>to accomplish. I know Ed at Topozone.com is using template mapfile 
>>fragments and using the cpp and Makefiles to generate a large number 
>>of mapfiles based on change the DEFINES. That way if you need to make 
>>a change to a section that is in all your mapfiles you just change one

>>file and type make.
>>
>>But before you solve the technology, you might want to describe why 
>>you need  200 mapfiles and what type of things are changing from one 
>>to the other. There might be much better solutions.
>>
>>-Steve W.
>>
>>Dylan Beaudette wrote:
>>
>>>Hi everyone,
>>>
>>>We have been using Mapserver for about a year now with a great deal 
>>>of success on small projects (i.e. single map file, single html 
>>>template, single query template).
>>>
>>>Now that we are considering a more complicated project with nearly 
>>>200 .map files and their associated html templates and query 
>>>templates - quite a bit to manage should any cosmetic changes need to

>>>be made in the map files.
>>>
>>>Is there any way to "include" bits of a central map file to 
>>>consolidate the configuration of such a large project, or would it be

>>>better to use a single .map file, customizing it through the URL
passed to it...
>>>
>>>...or is phpmapscript a viable option?
>>>
>>>thanks in advancce for any ideas!
>>>
>>>
>>>
>>>--
>>>Dylan Beaudette
>>>Soils and Biogeochemistry Graduate Group University of California at 
>>>Davis
>>>530.754.7341
>
>



More information about the mapserver-users mailing list