[mapserver-users] Passing a mapfile via CGI
Bob Basques
Bob.Basques at ci.stpaul.mn.us
Mon Apr 16 13:56:13 PDT 2012
Actually, I'm working on that very capability in another project right now. A bit more comprehensive in the details. Exact functionality you just described though.
bobb
>>> Brent Fraser <bfraser at geoanalytic.com> wrote:
It would make an interesting user extension in GeoMoose:
- Based on some GUI trigger (a button?), request a list of layers from a URL (hey, a "getCapabilites" style service!), and populate/replace the layer list in the catalog.
That would be cool...
Best Regards,
Brent Fraser
On 4/16/2012 2:07 PM, Bob Basques wrote:
Yeah, the problem is, the list of GPSs is variable.
It's all in POSTGIS now, and by GPS name.
bobb
>>> Brent Fraser <bfraser at geoanalytic.com> ( mailto:bfraser at geoanalytic.com ) wrote:
I guess my solution would be to put the trails in a PostGIS table:
Trails:
id name geometry
1 trail A 234523452345
2 trail B 5879567876454
Use one map file with a FILTER "name='%trail_name%'". Now use http://.../mapserv?trail_name="trail A" to have mapserver do the variable substitution in the mapfile.
The bigger problem is generating the GUI layer list with the pointers to the mapserver URLs. A script/database generated mapbook in GeoMoose, or JavaScript list for use with OpenLayers, etc...
Best Regards,
Brent Fraser
On 4/16/2012 1:41 PM, Bob Basques wrote:
Individual trails, one layer per GPS to allow user control of visibility.
bobb
>>> Brent Fraser <bfraser at geoanalytic.com> ( mailto:bfraser at geoanalytic.com ) wrote:
Well, in this application I don't care about a feature's real-world attributes (only the geometry and their feature "class"), so I'm able to pack all polygons into one table. I then join the polygon table to the feature class table to get the color, etc.
Are you representing each GPS trail as a separate layer? So the user can turn individual trail on/off in a layer control?
Best Regards,
Brent Fraser
On 4/16/2012 1:07 PM, Bob Basques wrote:
Hmm, interesting apporach, reminds me of my ealier days with Oracle (before Oracle Spatial, where each feature type needed it's own table structure . . . Have to do some more thinking on this one.
I'm trying to render a predefined list of layers (from the user) of a set of GPS trails that are BEGIN and END indexed.
bobb
>>> Brent Fraser <bfraser at geoanalytic.com> ( mailto:bfraser at geoanalytic.com ) wrote:
Bob,
What kinds of things are you trying to do with layers? Are the layers vectors? Maybe there's a different way...
I'm in the midst of an implementation where the vectors are held in PostGIS in three tables (point, line and polygon) and joined to a "feature definition" table (to supply rendering values). I use one map file with three layers (point, line, polygon) and pass a FILTER variable to get my different layers which are then rendered.
Here's a snippet from the polygon layer:
CLASS
STYLE # Polygon Fill
SYMBOL [polyfill_symbol]
COLOR [polyfill_fillcolor]
ANGLE [polyfill_angle]
SIZE [polyfill_hatchgap] # e.g Hatching gap
WIDTH 1 # [polyfill_hatchthick] # Hatching line thickness (column binding doesn't seem to work)
# OPACITY 50 # [attribute] # warning: there is no OPACITY for LABEL so don't bother.
END
STYLE # Polygon Outline
SYMBOL [geom_symbol]
OUTLINECOLOR [geom_outcolor]
SIZE [geom_width] # for "simple" (?) symbols
WIDTH [geom_width] # for complex symbols
END # Style
TEXT ([gid])
LABEL
TYPE TRUETYPE
FONT [label_font]
ANTIALIAS TRUE
COLOR [label_fillcolor]
OUTLINECOLOR [label_outcolor]
BUFFER 1
POSITION cc # [ul|uc|ur|cl|cc|cr|ll|lc|lr|auto]
PARTIALS TRUE
SIZE [label_height]
END # LABEL
END # class
While this method is suitable for rendering, it will be a problem if you want store variables for use in an identify operation (or maybe not; I wonder if a template name can be bound to a database column...)
Best Regards,
Brent Fraser
On 4/16/2012 10:22 AM, Bob Basques wrote:
All,
Did anything ever develop from this idea? I need to generate a variable length list of layers pro grammatically.
I'm not finding anything from a quick search of things related to passing a MAPFILE via the CGI call. I want to be able to generate a MAPFILE, or chunks of it, on the fly. A possible solution (maybe scary security wise) would be to use a param like "INCLUDE_<someID>=", to pass in MAP fragments to an existing MAPFILE. I need to essentially add layers.
Another thought I had (Ok, it's a bit odd, I'll admit . . .) would be to have MapServer build it's own MAPFILE as a TEMPLATE output, but I'm not coming up with a way immediately of passing the resulting MAPFILE to Mapserver in the end.
bobb
_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20120416/f0c7e2e7/attachment.htm>
More information about the MapServer-users
mailing list