[Mapserver-users] MapServer and Java
Steve Lime
steve.lime at dnr.state.mn.us
Tue Feb 11 14:31:38 PST 2003
--=_ABF4D1CD.90F1BD8A
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
See attached. It's pretty simple and certainly ripe for extension...
Steve
>>> "Zhang, William" <wzhang at c-cor.net> 02/11/03 04:09PM >>>
Steve,
I am quite interested in the source code of your java bean. Where can I =
take
a look at it?
Thanks,
William Zhang
Software Engineer
C-Cor.net
5673 Gibraltar Dr., Suite 100
Pleasanton, CA 94588
Phone: (925) 251-3019
Fax: (925) 467-0600
E-Mail: wzhang at c-cor.net=20
-----Original Message-----
From: Steve Lime [mailto:steve.lime at dnr.state.mn.us]=20
Sent: Tuesday, February 11, 2003 1:08 PM
To: mapserver-users at lists.gis.umn.edu; christian.schuster at rsag.ch=20
Subject: Re: [Mapserver-users] MapServer and Java
I wrote a simple java (bean) wrapper for the CGI version of MapServer that
would
allow the programmer to build a service call programatically and then =
submit
a request=20
that service. That combined with a simple template on the MapServer side
results in a
hash of parameters to be returned to the calling program. The base id,
extent, image
names and so on could be nabbed that way. MapServer could also respond =
with
straight
XML is so desired. Here's an example usage:
MapServerBean msb =3D new MapServerBean();
HashMap content;
msb.setMap("MAPFILE");
msb.setMapsize("500 500");
msb.setLayers("mypoints"); // multiple layers seperated by spaces
// points to add to the map (3rd column is a label)
msb.addPoint(492428.9862,4971809.3571,"55118","mypoints");
msb.addPoint(402100.0259,5134187.6075,"56425","mypoints");
msb.addPoint(293507.7264,5273181.9598,"56542","mypoints");
msb.addPoint(283147.0886,5188256.4327,"56501","mypoints");
try {
content =3D msb.getMap(); =20
} catch (Exception e) {}
The template used by MapServer is something like:
mapext=3D[mapext]
img=3Dhttp://[host]:[port][img]
Seemed to work ok. Source is available if anyone cares...
Steve
Stephen Lime
Data & Applications Manager
Minnesota DNR
500 Lafayette Road
St. Paul, MN 55155
651-297-2937
>>> <christian.schuster at rsag.ch> 02/11/03 12:31AM >>>
Hi List,
My problem is that I am working on a WebApplikation based on Java. Now, we
also will need to include geographic pictures for references purposes. The
data are in PostgreSQL. Now, I have a working MapServer and I can bring up
the pictures using PostGIS. But what I would like is just to get the name
of the pictures (eq image, refimage, scalebar, legend) MapServer has
created which I can then load into to the WebApplikation with normal GET
calls to the server. I looked at Mapplet. But this is not really what I am
looking for. Is there a possibility to get the names of the picture
MapServer created?
Regards,
Christian Schuster
Rudolf Schuster AG
Postfach 277
CH - 3000 Bern 11
http://www.rsag.ch=20
++41 31 348 05 30
_______________________________________________
Mapserver-users mailing list
Mapserver-users at lists.gis.umn.edu=20
http://lists.gis.umn.edu/mailman/listinfo/mapserver-users=20
_______________________________________________
Mapserver-users mailing list
Mapserver-users at lists.gis.umn.edu=20
http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
--=_ABF4D1CD.90F1BD8A
Content-Type: application/octet-stream; name="MapServerBean.java"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="MapServerBean.java"
cGFja2FnZSB1cy5tbi5zdGF0ZS5kbnI7CgppbXBvcnQgamF2YXguc2VydmxldC5odHRwLio7Cmlt
cG9ydCBqYXZhLmlvLio7CmltcG9ydCBqYXZhLm5ldC4qOwppbXBvcnQgamF2YS51dGlsLio7Cmlt
cG9ydCBvcmcuYXBhY2hlLm9yby50ZXh0LnBlcmwuKjsKCnB1YmxpYyBjbGFzcyBNYXBTZXJ2ZXJC
ZWFuIHsKICAgIHByaXZhdGUgZmluYWwgaW50IERFRkFVTFRfTlBPSU5UUz0xMDA7CgogICAgcHJp
dmF0ZSBQb2ludEZlYXR1cmUgcG9pbnRzW107CiAgICBwcml2YXRlIGludCBucG9pbnRzPTA7CiAg
ICAKICAgIHByaXZhdGUgU3RyaW5nIG1hcD1udWxsOwogICAgcHJpdmF0ZSBTdHJpbmcgc2VydmVy
PSJodHRwOi8vbWFwcy5kbnIuc3RhdGUubW4udXMvY2dpLWJpbi9tYXBzZXJ2My42IjsKICAgIHBy
aXZ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IAoJICAgIGZvcm1Db250ZW50LmFwcGVuZCgiJm1h
cF8iICsgdGhpcy5wb2ludHNbaV0ubGF5ZXIgKyAiX2ZlYXR1cmVfdGV4dD0iKyBVUkxFbmNvZGVy
LmVuY29kZSh0aGlzLnBvaW50c1tpXS5sYWJlbCkpOwoJfQoKCS8vIFN5c3RlbS5vdXQucHJpbnRs
bihmb3JtQ29udGVudC50b1N0cmluZygpKTsKCgkvKgoJKiogc3VibWl0IHRoZSByZXF1ZXN0IHRv
IHRoZSBNYXBTZXJ2ZXIgc2VydmVyIGFuZCBwYWNrYWdlIHRoZSByZXN1bHRzCgkqLwoJSHR0cFV0
aWxzIGh1ID0gbmV3IEh0dHBVdGlscygpOwoJcmVzcG9uc2VQYXJhbWV0ZXJzID0gbWFrZVBhcmFt
ZXRlcnMoaHUucG9zdENvbnRlbnRzKHRoaXMuc2VydmVyLCByZXF1ZXN0SGVhZGVycywgZm9ybUNv
bnRlbnQudG9TdHJpbmcoKSkpOwoJCQoJcmV0dXJuKHJlc3BvbnNlUGFyYW1ldGVycyk7CiAgICB9
Cn0K
--=_ABF4D1CD.90F1BD8A
Content-Type: application/octet-stream; name="PointFeature.java"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="PointFeature.java"
cGFja2FnZSB1cy5tbi5zdGF0ZS5kbnI7CgpwdWJsaWMgY2xhc3MgUG9pbnRGZWF0dXJlIHsKICBk
b3VibGUgeCwgeTsKICBTdHJpbmcgbGFiZWw7CiAgU3RyaW5nIGxheWVyOwoKICBwdWJsaWMgUG9p
bnRGZWF0dXJlKGRvdWJsZSB4LCBkb3VibGUgeSwgU3RyaW5nIGxhYmVsLCBTdHJpbmcgbGF5ZXIp
IHsgCiAgICB0aGlzLnggPSB4OwogICAgdGhpcy55ID0geTsKICAgIHRoaXMubGFiZWwgPSBsYWJl
bDsKICAgIHRoaXMubGF5ZXIgPSBsYXllcjsKICB9Cn0K
--=_ABF4D1CD.90F1BD8A--
More information about the MapServer-users
mailing list