[mapserver-users] How to draw a circle with a centroid and radius

2008-05-12 Thread Sucharita Samuel
Hi Friends,
   I am really stuck up with this for a long time now. As far as
I have googled, I have found that to draw a circle, either using a mapfile
or dynamically using a mapscript, the circle has to be defined by two set of
points of its bounding rectangle. The image that I get on my screen is a
circle (because the layer is defined as a circle), but to draw this circle,
a set of two points is used which ultimately is a line. I will provide my
code sample below,

DrawCircle(double x, double y, double dRadius)
{
 double minx = x - dRadius;
 double miny = y + dRadius;
 double maxx = x + dRadius;
 double maxy = y - dRadius;

 //upper left corner of the bounding rectangle
 pointObj oPointMin = pixel2point(new pointObj(minx, miny, 0, 0));

//lower right corner of the bounding rectangle
 pointObj oPointMax = pixel2point(new pointObj(maxx, maxy, 0, 0));

 lineObj oLine = new lineObj();
 oLine.add(oPointMin);
 oLine.add(oPointMax);
 shapeObj oShp = new shapeObj((int)MS_SHAPE_TYPE.MS_SHAPE_LINE);
  oShp.add(oLine);

// Creation of a temporary layer (for circle)
   layerObj oTempLayer = new layerObj(map);
oTempLayer.name = "UserCircle";
oTempLayer.status = 1;
oTempLayer.type = MS_LAYER_TYPE.MS_LAYER_CIRCLE;
classObj oTempClass = new classObj(oTempLayer);
styleObj oStyle = new styleObj(oTempClass);
oStyle.outlinecolor.setRGB(0, 0, 0);
oStyle.color.setRGB(255, 227, 255);
oTempLayer.addFeature(oShp);

 In the last line, I add the shape object to the temporary layer and
then draw that layer which thus gives me a circle. But now, I want to find
the intersection of this circle with the underlying layer features which I
am unable to do, as the circle is not actually a circle or polygon that will
give me the intersection and thus the area of intersection.

The link
http://lists.dmsolutions.ca/pipermail/mapserver-users/2004-March/016983.html
has a code sample to draw a circle with polygon but that code doesn't seem
to work because it does not give me a circle but some other shaped polygon.


Friends, please help me with this problem.

Thanks,
Sucharita.
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] How to draw a circle with a centroid and radius

2008-05-12 Thread P Kishor
Sucharita,

Did you read some of the things I wrote in my reply to you? Look below
for more...

On 5/12/08, Sucharita Samuel <[EMAIL PROTECTED]> wrote:
> Hi Friends,
>I am really stuck up with this for a long time now. As far as
> I have googled, I have found that to draw a circle, either using a mapfile
> or dynamically using a mapscript, the circle has to be defined by two set of
> points of its bounding rectangle. The image that I get on my screen is a
> circle (because the layer is defined as a circle), but to draw this circle,
> a set of two points is used which ultimately is a line. I will provide my
> code sample below,
>
> DrawCircle(double x, double y, double dRadius)
> {
>  double minx = x - dRadius;
>  double miny = y + dRadius;
>  double maxx = x + dRadius;
>  double maxy = y - dRadius;
>
>  //upper left corner of the bounding rectangle
>   pointObj oPointMin = pixel2point(new pointObj(minx, miny, 0, 0));
>
> //lower right corner of the bounding rectangle
>  pointObj oPointMax = pixel2point(new pointObj(maxx, maxy, 0, 0));
>
>  lineObj oLine = new lineObj();
>  oLine.add(oPointMin);
>  oLine.add(oPointMax);
>  shapeObj oShp = new
> shapeObj((int)MS_SHAPE_TYPE.MS_SHAPE_LINE);
>   oShp.add(oLine);
>
> // Creation of a temporary layer (for circle)
>layerObj oTempLayer = new layerObj(map);
> oTempLayer.name = "UserCircle";
> oTempLayer.status = 1;
>  oTempLayer.type = MS_LAYER_TYPE.MS_LAYER_CIRCLE;
> classObj oTempClass = new classObj(oTempLayer);
> styleObj oStyle = new styleObj(oTempClass);
>  oStyle.outlinecolor.setRGB(0, 0, 0);
> oStyle.color.setRGB(255, 227, 255);
> oTempLayer.addFeature(oShp);
>
>  In the last line, I add the shape object to the temporary layer and
> then draw that layer which thus gives me a circle. But now, I want to find
> the intersection of this circle with the underlying layer features which I
> am unable to do, as the circle is not actually a circle or polygon that will
> give me the intersection and thus the area of intersection.
>
> The link
> http://lists.dmsolutions.ca/pipermail/mapserver-users/2004-March/016983.html
>  has a code sample to draw a circle with polygon but that code doesn't seem
> to work because it does not give me a circle but some other shaped polygon.

That shape is indeed a circle. Think about it... a circle is a polygon
with points that lie on the circumference. Right? There are infinite
such points, so the more points you draw the smoother will be your
circle. Of course, too many points becomes pointless because a coarse
circle can be good enough for one's purpose. The code that is
referenced in the email above uses a 10 degrees increment to place 37
points on the circle's circumference (the last point is the same as
the first point).

Ok, that takes care of the circle. Your problem doesn't end with
creating a circle. You want to find out the percentage overlap with a
polygon. My MapServer/MapScript knowledge is extremely rusty, but I am
not sure there is any way to do that with MapServer. It may be
possible with MapScript (I am actually writing some poly-on-poly
routines in Perl, but they are difficult to do). To do a poly-on-poly
overlay, you will likely have to implement PostGIS.

You have been asking this question for a while on this list and you
haven't really received any definitive answer other than mine. Maybe
you should start with determining the capabilities of
MapServer/MapScript first to evaluate if that can solve your problem.



>
>
> Friends, please help me with this problem.
>
> Thanks,
> Sucharita.
>
> ___
>  mapserver-users mailing list
>  mapserver-users@lists.osgeo.org
>  http://lists.osgeo.org/mailman/listinfo/mapserver-users
>
>


-- 
Puneet Kishor http://punkish.eidesis.org/
Nelson Institute for Environmental Studies http://www.nelson.wisc.edu/
Open Source Geospatial Foundation (OSGeo) http://www.osgeo.org/
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] Pattern

2008-05-12 Thread thomas bonfort
The functionality has been freshly implemented in trunk. you get it with

SYMBOL
 TYPE HATCH
 PATTERN 2 2 END
END

regards,
thomas

On Sat, May 10, 2008 at 5:41 PM, Giacomo Sacchetti <[EMAIL PROTECTED]> wrote:
> Hi all,
>
>  how I can create dashed HATCH symbols? There are just few lines of
> documentation for the HATCH symbol...
>
>  Best,
>  GS
>
>
>
>
>
>  ___
>  mapserver-users mailing list
>  mapserver-users@lists.osgeo.org
>  http://lists.osgeo.org/mailman/listinfo/mapserver-users
>
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] AGG vs. GD: Label placement problems

2008-05-12 Thread thomas bonfort
This issue should now be fixed in trunk, if you have time to confirm
that would be great!
regards,
thomas

On Tue, Mar 18, 2008 at 2:10 PM, thomas bonfort
<[EMAIL PROTECTED]> wrote:
> http://trac.osgeo.org/mapserver/ticket/2357
>
>
>
>  On Tue, Mar 18, 2008 at 1:05 PM, Doyon, Jean-Francois
>  <[EMAIL PROTECTED]> wrote:
>  > Thanks Thomas, that'd be great ... is there a ticket open for this, or
>  >  should I open one? (I'd like to track progress on this issue ...)
>  >
>  >  J.F.
>  >
>  >
>  >
>  >  -Original Message-
>  >  From: [EMAIL PROTECTED]
>  >  [mailto:[EMAIL PROTECTED] On Behalf Of thomas
>  >  bonfort
>  >  Sent: March 18, 2008 03:42
>  >  Cc: mapserver-users@lists.osgeo.org
>  >  Subject: Re: [mapserver-users] AGG vs. GD: Label placement problems
>  >
>  >  Yes, that's exactly the problem, as there's a difference of a few pixels
>  >  between the size of the label calculated by gd and the size it actually
>  >  takes when rendered with agg. I realize now that it can cause some quite
>  >  visible problems in the case you show here (labels to the left), as in
>  >  that case the few pixels difference can cause the label to overlap the
>  >  point symbol. I'll see if I can fix this in the days/weeks to come so
>  >  this can be included in 5.2
>  >
>  >  cheers,
>  >  thomas
>  >
>  >  On Mon, Mar 17, 2008 at 8:25 PM, Daniel Morissette
>  >  <[EMAIL PROTECTED]> wrote:
>  >  > Doyon, Jean-Francois wrote:
>  >  >  >
>  >  >  > Labels that are to the left of the point seem to be placed
>  >  differently ... Look top-right ("Les Escoumins", "Saint Anne de Port
>  >  Neuf", etc ...) for an example, though it happens all over the place I
>  >  think.  Labels to the right of the point however seem ok.
>  >  >  >
>  >  >  > Is this a bug? A design change?  Can anything be done from the
>  >  mapfiel to mitigate this?
>  >  >  >
>  >  >
>  >  >  A few days ago, ThomasB wrote on mapserver-dev that in AGG mode, "gd
>  >  > is  still used [...] for the calculation of label sizes (thus some
>  >  > subtle  discreptancies in label placement, mostly visible if using a
>  >  > label
>  >  >  backgroundcolor)":
>  >  >
>  >  >  http://lists.osgeo.org/pipermail/mapserver-dev/2008-March/006868.html
>  >  >
>  >  >  Maybe that's what your running into? Hopefully Thomas will see this
>  >  > and  comment.
>  >  >
>  >  >  Daniel
>  >  >  --
>  >  >  Daniel Morissette
>  >  >  http://www.mapgears.com/
>  >  >
>  >  >
>  >  > ___
>  >  >  mapserver-users mailing list
>  >  >  mapserver-users@lists.osgeo.org
>  >  >  http://lists.osgeo.org/mailman/listinfo/mapserver-users
>  >  >
>  >  ___
>  >  mapserver-users mailing list
>  >  mapserver-users@lists.osgeo.org
>  >  http://lists.osgeo.org/mailman/listinfo/mapserver-users
>  >
>
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


[mapserver-users] Customized layer for Mapserver/Kamap

2008-05-12 Thread Emilio Ponce
Hi everyone,

I'm working with mapserver using ka-map. Now I'm trying to create a new
layer over the others using alphanumeric data, and  I was wondering  what's
the best method.
My idea is to represent this data with a colour gradient. For example if the
data are like this:

City  Population
---
Barcelona 400
Madrid  700

I want to represent the Barcelona area with a light red colour, and Madrid
with a darker red.
Someone told me that the only input to Ka-map is mapserver, and mapserver
uses GDAL/OGR library for this kind of tasks... so what is the best kind of
input format using this library? And in order to represent the data with the
colour gradient, where I have to link the alphanumeric data (e.g 400)
with the colour (e.g. dark red)?

Thank you very much guys!
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] Customized layer for Mapserver/Kamap

2008-05-12 Thread Florin A.
Hi,

Kamap was designed to only take Mapserver input, yes.
Mapserver will take most formats.  You can have data in shapefiles, in
a database, a raster image, or in a text file.
Do you have polygons for the cities or do you want to just draw a
circle at their lat/long ?



On Mon, May 12, 2008 at 4:20 PM, Emilio Ponce <[EMAIL PROTECTED]> wrote:
> Hi everyone,
>
> I'm working with mapserver using ka-map. Now I'm trying to create a new
> layer over the others using alphanumeric data, and  I was wondering  what's
> the best method.
> My idea is to represent this data with a colour gradient. For example if the
> data are like this:
>
> City  Population
> ---
> Barcelona 400
> Madrid  700
>
> I want to represent the Barcelona area with a light red colour, and Madrid
> with a darker red.
> Someone told me that the only input to Ka-map is mapserver, and mapserver
> uses GDAL/OGR library for this kind of tasks... so what is the best kind of
> input format using this library? And in order to represent the data with the
> colour gradient, where I have to link the alphanumeric data (e.g 400)
> with the colour (e.g. dark red)?
>
> Thank you very much guys!
>
>
>
> ___
>  mapserver-users mailing list
>  mapserver-users@lists.osgeo.org
>  http://lists.osgeo.org/mailman/listinfo/mapserver-users
>
>
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


[mapserver-users] Does MS4W multi-thread?

2008-05-12 Thread J.J. Schlafley
Hi all,
Will the mapserver CGI program multi-thread on an MS4W installation.  I noticed 
many "mapserver.exe" image names in the task manager on my server.  Assuming 
each image name corresponds with each request or thread, will the OS delegate 
the processes to other CPU cores if available?  I currently only have a single 
core Xeon, but am wondering if a multi-core CPU could be beneficial with Apache 
and Mapserver (MS4W).
Thanks


  ___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] Pattern

2008-05-12 Thread Giacomo Sacchetti
Thanks a lot! By the way, is it possible to define lines with dash and  
dots also?


Best,
GS

On May 12, 2008, at 7:29 PM, thomas bonfort wrote:

The functionality has been freshly implemented in trunk. you get it  
with


SYMBOL
TYPE HATCH
PATTERN 2 2 END
END

regards,
thomas

On Sat, May 10, 2008 at 5:41 PM, Giacomo Sacchetti <[EMAIL PROTECTED] 
> wrote:

Hi all,

how I can create dashed HATCH symbols? There are just few lines of
documentation for the HATCH symbol...

Best,
GS





___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users



--
  Giacomo Sacchetti | http://www.nepero.net/

"Ogni uomo nasce gemello, colui che e` e colui
che crede di essere."-- Martin Kessel



___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users