[mapserver-users] How to draw a circle using MapScript?
Lime, Steve D (DNR)
Steve.Lime at state.mn.us
Fri Dec 18 11:55:18 PST 2009
Here's an example that draws a 1km diameter two different ways:
http://maps.dnr.state.mn.us/mapserver_demos/circles.map
It shows two ways to do this. One using a circle layer and the other using a circle symbol but with different size units (e.g. non-pixel).
Apparently a circle layer takes features consisting of two points where the points are on the circle and directly opposite one another. Their mid-point defines the center point. Why I did it this way is a bit of a mystery but it is what it is...
The buffer method is also perfectly valid.
Steve
-----Original Message-----
From: Helen Eskina [mailto:heskina at ubitech.com]
Sent: Friday, December 18, 2009 9:23 AM
To: Lime, Steve D (DNR)
Subject: RE: [mapserver-users] How to draw a circle using MapScript?
Hi Steve,
Thank you for the reply! Looking forward to your example!
Helen
-----Original Message-----
From: Lime, Steve D (DNR) [mailto:Steve.Lime at state.mn.us]
Sent: Thursday, December 17, 2009 6:29 PM
To: Lime, Steve D (DNR); Dan Little; Helen Eskina;
mapserver-users at lists.osgeo.org
Subject: RE: [mapserver-users] How to draw a circle using MapScript?
After mulling this over I think I'm wrong. Conceptually it's correct but
the points represent the center and a point on the circle I think. I'll
post a stand-alone example later tonite...
Steve
________________________________________
From: mapserver-users-bounces at lists.osgeo.org
[mapserver-users-bounces at lists.osgeo.org] On Behalf Of Lime, Steve D (DNR)
[Steve.Lime at state.mn.us]
Sent: Thursday, December 17, 2009 4:30 PM
To: Dan Little; Helen Eskina; mapserver-users at lists.osgeo.org
Subject: RE: [mapserver-users] How to draw a circle using MapScript?
In another approach, I believe MapServer wants you to define a bounding
box for the circle by creating a line shape with the first point at the UL
coordinate of that box and the second coordinate at the LR coordinate of
the box. So you'd offset your center point .5 KM to create those points.
You can add the resulting shape to the appropriate layer to draw it.
I'll check to make sure, but I think that will work.
Steve
From: mapserver-users-bounces at lists.osgeo.org
[mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Dan Little
Sent: Thursday, December 17, 2009 3:54 PM
To: Helen Eskina; mapserver-users at lists.osgeo.org
Subject: Re: [mapserver-users] How to draw a circle using MapScript?
Totally off the cuff....
$shape = ms_shapeObjFromWKT('POINT('+$x+' '+$y+')');
$shape = $shape->buffer($radius);
From: Helen Eskina <heskina at ubitech.com>
To: mapserver-users at lists.osgeo.org
Sent: Thu, December 17, 2009 3:50:20 PM
Subject: [mapserver-users] How to draw a circle using MapScript?
Hello List,
I want to be able to draw a circle dynamically using PHP MapScript. The
circle is defined by the coordinates of the centre and the radius in
kilometers. I realize that the circle is a polygon and I should probably
calculate all points. What is the best way to do it?
I would really appreciate any help!
Thank you,
Helen
No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.427 / Virus Database: 270.14.103/2558 - Release Date:
12/17/09 08:30:00
More information about the MapServer-users
mailing list