RE: [mapguide-users] Thematic Mapping

2009-02-04 Thread padmini godavarthi
; + FeatId + quot; = ;

filterText = filterText + value;

areaRuleXML = String.Format(areaRuleTemplate,
  FeatId + : + value,
filterText,
InterpolateColor(portion, 00, 00, 0), InterpolateColor(portion,
00, 00, 0));
areaDoc = new XmlDocument();
areaDoc.LoadXml(areaRuleXML);
areaDoc.Save(C:\\theme.xml);
areaNode = doc.ImportNode(areaDoc.DocumentElement, true);
areaTypeStyle.AppendChild(areaNode);


portion = portion + increment;
}
dataReader1.Close();
// Now save our new layer definition to the session and add it to
the map.

String xmlString = doc.DocumentElement.OuterXml;
String uniqueName = this.MakeUniqueLayerName(map, property layer,
sample);
String legendLabel = layer.GetLegendLabel();
if (sample.Length  0)
legendLabel = legendLabel +  ( + sample + );
MgResourceIdentifier layerResId = new
MgResourceIdentifier(Session: + sessionId + // + uniqueName +
.LayerDefinition);
resourceService.SetResource(layerResId, new MgByteReader(xmlString,
text/xml), null);
MgLayer newLayer = new MgLayer(layerResId, resourceService);
newLayer.SetName(uniqueName);
newLayer.SetLegendLabel(legendLabel);
newLayer.SetDisplayInLegend(layer.GetDisplayInLegend());
newLayer.SetVisible(true);
newLayer.SetSelectable(layer.GetSelectable());
layers.Insert(layers.IndexOf(layer), newLayer);
map.Save(resourceService);
return uniqueName;
}
now iam able to get different colour to the polygon (having Property  as
FeatId=2984 ) other polygons were in different colour.
Now my problem is that this works fine for Filebased Package(Shapefile).When
i used this code for oracle based package i got an error at 

  aggregateoption.Setfilter option

the error was
An exception of type 'OSGeo.MapGuide.MgFdoException' occurred in
MapGuideDotNetApi.DLL but was not handled in user code

can u plz tell me so it will be helpful to me.


Thanks and Regards,
Padmini.




Chris Claydon wrote:
 
 Hi Padmini,
 
 The InterpolateColor() function in your code below has a method signature
 like this:
 
 private String InterpolateColor(double portion, String startColor, String
 endColor, int percentTransparent)
 
 You should set the startColor string to be the first color you want to use
 in your range of colors, and the endColor string to be the last color.
 Then, depending on the value of the portion parameter that you pass in,
 the resulting color will fall somewhere in the range you've specified.
 
 In the code you've included below, you have two calls to
 InterpolateColor(). One of them controls the fill color of your polygons
 and the other controls the edge color. The problem is that in each call,
 you've still specified that the startColor is the same as the endColor.
 For example:
 
 InterpolateColor(portion, C2C3C4, C2C3C4, 0) will only ever return you
 the color that corresponds to C2C3C4. If you change one of the strings,
 you should see some color variation. E.g.
 
 InterpolateColor(portion, 00FF00, FF, 0)
 
 Try that and see what happens.
 
 It seems to me that you do not yet have a very strong understanding of how
 the code below actually functions. I would urge you to spend some time
 looking at it to try to figure it out. I appreciate that some of it is
 quite complex, and you should feel free to ask questions on the newsgroup
 to help you. I can't claim to speak for anyone else on this group, but
 personally I would rather help others to learn to understand the
 framework, and write their own code, than simply to provide pre-written
 solutions to their problems.
 
 Chris.
 
 -Original Message-
 From: mapguide-users-boun...@lists.osgeo.org
 [mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of padmini
 godavarthi
 Sent: Sunday, February 01, 2009 9:22 PM
 To: mapguide-users@lists.osgeo.org
 Subject: Re: [mapguide-users] Thematic Mapping
 
 
 Hi z,
 Thanku very much for ur suggestions.i will respect it.
 but i understood the answer given by Chris.
 But i think its not correct solution for my original query.
 i want to display different colors to the different polygons.
 but while applying 2 colors in the InterpolateColor function it doesn't
 change in different colors
 
 
 
  while (dataReader.ReadNext())
 {
 value = GetFeaturePropertyValue(dataReader, FeatId);
 
 filterText = quot; + FeatId + quot; = ;
 
 filterText = filterText + value;
 
 areaRuleXML = String.Format(areaRuleTemplate,
   FeatId + : + value,
 filterText,
 InterpolateColor(portion, C2C3C4, C2C3C4, 0),
 InterpolateColor(portion,
 00, 00, 0

RE: [mapguide-users] Thematic Mapping

2009-02-02 Thread Chris Claydon
Hi Padmini,

The InterpolateColor() function in your code below has a method signature like 
this:

private String InterpolateColor(double portion, String startColor, String 
endColor, int percentTransparent)

You should set the startColor string to be the first color you want to use in 
your range of colors, and the endColor string to be the last color. Then, 
depending on the value of the portion parameter that you pass in, the 
resulting color will fall somewhere in the range you've specified.

In the code you've included below, you have two calls to InterpolateColor(). 
One of them controls the fill color of your polygons and the other controls the 
edge color. The problem is that in each call, you've still specified that the 
startColor is the same as the endColor. For example:

InterpolateColor(portion, C2C3C4, C2C3C4, 0) will only ever return you the 
color that corresponds to C2C3C4. If you change one of the strings, you 
should see some color variation. E.g.

InterpolateColor(portion, 00FF00, FF, 0)

Try that and see what happens.

It seems to me that you do not yet have a very strong understanding of how the 
code below actually functions. I would urge you to spend some time looking at 
it to try to figure it out. I appreciate that some of it is quite complex, and 
you should feel free to ask questions on the newsgroup to help you. I can't 
claim to speak for anyone else on this group, but personally I would rather 
help others to learn to understand the framework, and write their own code, 
than simply to provide pre-written solutions to their problems.

Chris.

-Original Message-
From: mapguide-users-boun...@lists.osgeo.org 
[mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of padmini godavarthi
Sent: Sunday, February 01, 2009 9:22 PM
To: mapguide-users@lists.osgeo.org
Subject: Re: [mapguide-users] Thematic Mapping


Hi z,
Thanku very much for ur suggestions.i will respect it.
but i understood the answer given by Chris.
But i think its not correct solution for my original query.
i want to display different colors to the different polygons.
but while applying 2 colors in the InterpolateColor function it doesn't
change in different colors



 while (dataReader.ReadNext())
{
value = GetFeaturePropertyValue(dataReader, FeatId);

filterText = quot; + FeatId + quot; = ;

filterText = filterText + value;

areaRuleXML = String.Format(areaRuleTemplate,
  FeatId + : + value,
filterText,
InterpolateColor(portion, C2C3C4, C2C3C4, 0), InterpolateColor(portion,
00, 00, 0));
areaDoc = new XmlDocument();
areaDoc.LoadXml(areaRuleXML);
areaDoc.Save(C:\\theme.xml);
areaNode = doc.ImportNode(areaDoc.DocumentElement, true);
areaTypeStyle.AppendChild(areaNode);


 portion = portion + increment;
}


it displays some yash color to all the polygons,but i want different color
to the different polygons
Can u plz help me

Thanks and Regards,
Padmini G.



zspitzer wrote:

 when someone takes times to provide a response, it's respectful to taking
 a bit more time to read your original email AGAIN !

 your calling

 InterpolateColor(portion, C2C3C4, C2C3C4, 0),
 InterpolateColor(portion,C2C3C4, C2C3C4, 0));

 which takes two colors to create a range, yet you pass in the same
 color twice

 sorry if I sound a bit grumpy, but it appears that Chris spent more
 time reading
 your email that you did after his reply

 z



 On Sat, Jan 31, 2009 at 7:57 PM, padmini godavarthi
 godavarthi.padm...@gmail.com wrote:

 Hi,
 Thanks for ur reply.but i didn't get u
 can u plz tell me briefly so that it will be helpful to me.


 Thanks and Regards,
 Padmini.


 Chris Claydon wrote:

 I would recommend modifying your call to InterpolateColor() so that the
 start color and end color correspond to the colors you want. They are
 currently both set to the same string.

 -Original Message-
 From: mapguide-users-boun...@lists.osgeo.org
 [mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of padmini
 godavarthi
 Sent: Friday, January 30, 2009 3:59 AM
 To: mapguide-users@lists.osgeo.org
 Subject: [mapguide-users] Thematic Mapping




 Hi,
 iam using mpguide opensource 2.0 (.net 2.0 +IIS 5.1).
 I want to do thematic mapping for polygon layer(for example parcel
 layer)
 i tried to use the code in dotnetviewer sample.its working fine

 iam able to create a thematic layer with same color to the all polygons.
 Now my problem is that i want to apply different colours to the
 different
 polygons

 for example for parcel_id =1    green colour
 for example for parcel_id =2    Red colour and
 soon.

 for this can u plz tell me the code for how to do it?


 my code was as follows

Re: [mapguide-users] Thematic Mapping

2009-02-01 Thread padmini godavarthi

Hi z,
Thanku very much for ur suggestions.i will respect it.
but i understood the answer given by Chris.
But i think its not correct solution for my original query.
i want to display different colors to the different polygons.
but while applying 2 colors in the InterpolateColor function it doesn't
change in different colors



 while (dataReader.ReadNext())
{
value = GetFeaturePropertyValue(dataReader, FeatId);

filterText = quot; + FeatId + quot; = ;
  
filterText = filterText + value;

areaRuleXML = String.Format(areaRuleTemplate,
  FeatId + : + value,
filterText,
InterpolateColor(portion, C2C3C4, C2C3C4, 0), InterpolateColor(portion,
00, 00, 0));
areaDoc = new XmlDocument();
areaDoc.LoadXml(areaRuleXML);
areaDoc.Save(C:\\theme.xml);
areaNode = doc.ImportNode(areaDoc.DocumentElement, true);
areaTypeStyle.AppendChild(areaNode);


 portion = portion + increment;
}


it displays some yash color to all the polygons,but i want different color
to the different polygons
Can u plz help me

Thanks and Regards,
Padmini G.



zspitzer wrote:
 
 when someone takes times to provide a response, it's respectful to taking
 a bit more time to read your original email AGAIN !
 
 your calling
 
 InterpolateColor(portion, C2C3C4, C2C3C4, 0),
 InterpolateColor(portion,C2C3C4, C2C3C4, 0));
 
 which takes two colors to create a range, yet you pass in the same
 color twice
 
 sorry if I sound a bit grumpy, but it appears that Chris spent more
 time reading
 your email that you did after his reply
 
 z
 
 
 
 On Sat, Jan 31, 2009 at 7:57 PM, padmini godavarthi
 godavarthi.padm...@gmail.com wrote:

 Hi,
 Thanks for ur reply.but i didn't get u
 can u plz tell me briefly so that it will be helpful to me.


 Thanks and Regards,
 Padmini.


 Chris Claydon wrote:

 I would recommend modifying your call to InterpolateColor() so that the
 start color and end color correspond to the colors you want. They are
 currently both set to the same string.

 -Original Message-
 From: mapguide-users-boun...@lists.osgeo.org
 [mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of padmini
 godavarthi
 Sent: Friday, January 30, 2009 3:59 AM
 To: mapguide-users@lists.osgeo.org
 Subject: [mapguide-users] Thematic Mapping




 Hi,
 iam using mpguide opensource 2.0 (.net 2.0 +IIS 5.1).
 I want to do thematic mapping for polygon layer(for example parcel
 layer)
 i tried to use the code in dotnetviewer sample.its working fine

 iam able to create a thematic layer with same color to the all polygons.
 Now my problem is that i want to apply different colours to the
 different
 polygons

 for example for parcel_id =1    green colour
 for example for parcel_id =2    Red colour and
 soon.

 for this can u plz tell me the code for how to do it?


 my code was as follows
 --


 NameValueCollection serverVars = Request.ServerVariables;
 String strServerVars = ;
 foreach (String str in serverVars.AllKeys)
 {

 strServerVars += br + str;

 }
 String platform = serverVars[SERVER_SOFTWARE];
 String queryStr = serverVars[QUERY_STRING];
 string queryStr1 = serverVars[Form];
 NameValueCollection requestParams = Request.HttpMethod == POST
 ?
 Request.Form : Request.QueryString;
 String sessionId = Request.QueryString[SESSION];
 string realPath = Request.ServerVariables[APPL_PHYSICAL_PATH];
 String configPath = realPath + webconfig.ini;
 MapGuideApi.MgInitializeWebTier(configPath);
 MgUserInformation userInfo = new MgUserInformation(sessionId);
 MgSiteConnection siteConnection = new MgSiteConnection();
 siteConnection.Open(userInfo);
 MgResourceService resourceService =
 (MgResourceService)siteConnection.CreateService(MgServiceType.ResourceService);
 MgFeatureService featureService =
 (MgFeatureService)siteConnection.CreateService(MgServiceType.FeatureService);

 MgMap map = new MgMap();
 map.Open(resourceService, mapdata);
 MgLayerCollection layers = map.GetLayers();
 MgLayer layer = (MgLayer)layers.GetItem(property layer);

 MgResourceIdentifier resId = new
 MgResourceIdentifier(layer.GetFeatureSourceId());
 MgResourceIdentifier layerDefResId = layer.GetLayerDefinition();
 MgByteReader byteReader =
 resourceService.GetResourceContent(layerDefResId);

 // Load the Layer Definition and Navigate to the specified
 VectorScaleRange

 XmlDocument doc = new XmlDocument();
 String xmlLayerDef = 

RE: [mapguide-users] Thematic Mapping

2009-01-31 Thread padmini godavarthi

Hi,
Thanks for ur reply.but i didn't get u
can u plz tell me briefly so that it will be helpful to me.


Thanks and Regards,
Padmini.


Chris Claydon wrote:
 
 I would recommend modifying your call to InterpolateColor() so that the
 start color and end color correspond to the colors you want. They are
 currently both set to the same string.
 
 -Original Message-
 From: mapguide-users-boun...@lists.osgeo.org
 [mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of padmini
 godavarthi
 Sent: Friday, January 30, 2009 3:59 AM
 To: mapguide-users@lists.osgeo.org
 Subject: [mapguide-users] Thematic Mapping
 
 
 
 
 Hi,
 iam using mpguide opensource 2.0 (.net 2.0 +IIS 5.1).
 I want to do thematic mapping for polygon layer(for example parcel layer)
 i tried to use the code in dotnetviewer sample.its working fine
 
 iam able to create a thematic layer with same color to the all polygons.
 Now my problem is that i want to apply different colours to the different
 polygons
 
 for example for parcel_id =1    green colour
 for example for parcel_id =2    Red colour and
 soon.
 
 for this can u plz tell me the code for how to do it?
 
 
 my code was as follows
 --
 
 
 NameValueCollection serverVars = Request.ServerVariables;
 String strServerVars = ;
 foreach (String str in serverVars.AllKeys)
 {
 
 strServerVars += br + str;
 
 }
 String platform = serverVars[SERVER_SOFTWARE];
 String queryStr = serverVars[QUERY_STRING];
 string queryStr1 = serverVars[Form];
 NameValueCollection requestParams = Request.HttpMethod == POST ?
 Request.Form : Request.QueryString;
 String sessionId = Request.QueryString[SESSION];
 string realPath = Request.ServerVariables[APPL_PHYSICAL_PATH];
 String configPath = realPath + webconfig.ini;
 MapGuideApi.MgInitializeWebTier(configPath);
 MgUserInformation userInfo = new MgUserInformation(sessionId);
 MgSiteConnection siteConnection = new MgSiteConnection();
 siteConnection.Open(userInfo);
 MgResourceService resourceService =
 (MgResourceService)siteConnection.CreateService(MgServiceType.ResourceService);
 MgFeatureService featureService =
 (MgFeatureService)siteConnection.CreateService(MgServiceType.FeatureService);
 
 MgMap map = new MgMap();
 map.Open(resourceService, mapdata);
 MgLayerCollection layers = map.GetLayers();
 MgLayer layer = (MgLayer)layers.GetItem(property layer);
 
 MgResourceIdentifier resId = new
 MgResourceIdentifier(layer.GetFeatureSourceId());
 MgResourceIdentifier layerDefResId = layer.GetLayerDefinition();
 MgByteReader byteReader =
 resourceService.GetResourceContent(layerDefResId);
 
 // Load the Layer Definition and Navigate to the specified
 VectorScaleRange
 
 XmlDocument doc = new XmlDocument();
 String xmlLayerDef = byteReader.ToString();
 doc.LoadXml(xmlLayerDef);
   XmlNodeList nodeList =
 doc.GetElementsByTagName(VectorScaleRange);
 
 XmlElement vectorScaleRangecElement = (XmlElement)nodeList.Item(0);
 XmlElement areaTypeStyle =
 (XmlElement)vectorScaleRangecElement.GetElementsByTagName(AreaTypeStyle).Item(0);
 
 // Remove any existing AreaRule elements.
 
 XmlNodeList areaRuleList =
 areaTypeStyle.GetElementsByTagName(AreaRule);
 int count = areaRuleList.Count;
 for (int i = 0; i  count; i++)
 {
 //The areaRuleList shrinks as we remove items, so always
 //remove the first item (don't use the index i)
 areaTypeStyle.RemoveChild(areaRuleList.Item(0));
 }
 
 // Now create the new AreaRule elements.
 
 String areaRuleTemplate =
 File.ReadAllText(GetThemeXmlTemplatePath());
 MgFeatureAggregateOptions aggregateOptions = new
 MgFeatureAggregateOptions();
 
 String value = null;
 String filterText = null;
 String areaRuleXML = null;
 XmlDocument areaDoc = null;
 XmlNode areaNode = null;
 double portion = 0.0;
 
 aggregateOptions.AddFeatureProperty(FeatId);
 aggregateOptions.SelectDistinct(true);
 aggregateOptions.SetFilter(totquery);
   double increment = (5  1) ? 1.0 / (5 - 1) : 1.0;
 MgDataReader dataReader =
 featureService.SelectAggregate(resId,
 layer.GetFeatureClassName(), aggregateOptions);
 while (dataReader.ReadNext())
 {
 value = GetFeaturePropertyValue(dataReader, FeatId);
 
 filterText = quot; + FeatId + quot; = ;
 
 filterText = filterText + value;
 
 areaRuleXML = String.Format(areaRuleTemplate,

Re: [mapguide-users] Thematic Mapping

2009-01-31 Thread Zac Spitzer
when someone takes times to provide a response, it's respectful to taking
a bit more time to read your original email AGAIN !

your calling

InterpolateColor(portion, C2C3C4, C2C3C4, 0),
InterpolateColor(portion,C2C3C4, C2C3C4, 0));

which takes two colors to create a range, yet you pass in the same
color twice

sorry if I sound a bit grumpy, but it appears that Chris spent more
time reading
your email that you did after his reply

z



On Sat, Jan 31, 2009 at 7:57 PM, padmini godavarthi
godavarthi.padm...@gmail.com wrote:

 Hi,
 Thanks for ur reply.but i didn't get u
 can u plz tell me briefly so that it will be helpful to me.


 Thanks and Regards,
 Padmini.


 Chris Claydon wrote:

 I would recommend modifying your call to InterpolateColor() so that the
 start color and end color correspond to the colors you want. They are
 currently both set to the same string.

 -Original Message-
 From: mapguide-users-boun...@lists.osgeo.org
 [mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of padmini
 godavarthi
 Sent: Friday, January 30, 2009 3:59 AM
 To: mapguide-users@lists.osgeo.org
 Subject: [mapguide-users] Thematic Mapping




 Hi,
 iam using mpguide opensource 2.0 (.net 2.0 +IIS 5.1).
 I want to do thematic mapping for polygon layer(for example parcel layer)
 i tried to use the code in dotnetviewer sample.its working fine

 iam able to create a thematic layer with same color to the all polygons.
 Now my problem is that i want to apply different colours to the different
 polygons

 for example for parcel_id =1    green colour
 for example for parcel_id =2    Red colour and
 soon.

 for this can u plz tell me the code for how to do it?


 my code was as follows
 --


 NameValueCollection serverVars = Request.ServerVariables;
 String strServerVars = ;
 foreach (String str in serverVars.AllKeys)
 {

 strServerVars += br + str;

 }
 String platform = serverVars[SERVER_SOFTWARE];
 String queryStr = serverVars[QUERY_STRING];
 string queryStr1 = serverVars[Form];
 NameValueCollection requestParams = Request.HttpMethod == POST ?
 Request.Form : Request.QueryString;
 String sessionId = Request.QueryString[SESSION];
 string realPath = Request.ServerVariables[APPL_PHYSICAL_PATH];
 String configPath = realPath + webconfig.ini;
 MapGuideApi.MgInitializeWebTier(configPath);
 MgUserInformation userInfo = new MgUserInformation(sessionId);
 MgSiteConnection siteConnection = new MgSiteConnection();
 siteConnection.Open(userInfo);
 MgResourceService resourceService =
 (MgResourceService)siteConnection.CreateService(MgServiceType.ResourceService);
 MgFeatureService featureService =
 (MgFeatureService)siteConnection.CreateService(MgServiceType.FeatureService);

 MgMap map = new MgMap();
 map.Open(resourceService, mapdata);
 MgLayerCollection layers = map.GetLayers();
 MgLayer layer = (MgLayer)layers.GetItem(property layer);

 MgResourceIdentifier resId = new
 MgResourceIdentifier(layer.GetFeatureSourceId());
 MgResourceIdentifier layerDefResId = layer.GetLayerDefinition();
 MgByteReader byteReader =
 resourceService.GetResourceContent(layerDefResId);

 // Load the Layer Definition and Navigate to the specified
 VectorScaleRange

 XmlDocument doc = new XmlDocument();
 String xmlLayerDef = byteReader.ToString();
 doc.LoadXml(xmlLayerDef);
   XmlNodeList nodeList =
 doc.GetElementsByTagName(VectorScaleRange);

 XmlElement vectorScaleRangecElement = (XmlElement)nodeList.Item(0);
 XmlElement areaTypeStyle =
 (XmlElement)vectorScaleRangecElement.GetElementsByTagName(AreaTypeStyle).Item(0);

 // Remove any existing AreaRule elements.

 XmlNodeList areaRuleList =
 areaTypeStyle.GetElementsByTagName(AreaRule);
 int count = areaRuleList.Count;
 for (int i = 0; i  count; i++)
 {
 //The areaRuleList shrinks as we remove items, so always
 //remove the first item (don't use the index i)
 areaTypeStyle.RemoveChild(areaRuleList.Item(0));
 }

 // Now create the new AreaRule elements.

 String areaRuleTemplate =
 File.ReadAllText(GetThemeXmlTemplatePath());
 MgFeatureAggregateOptions aggregateOptions = new
 MgFeatureAggregateOptions();

 String value = null;
 String filterText = null;
 String areaRuleXML = null;
 XmlDocument areaDoc = null;
 XmlNode areaNode = null;
 double portion = 0.0;

 aggregateOptions.AddFeatureProperty(FeatId);
 aggregateOptions.SelectDistinct(true);
 aggregateOptions.SetFilter(totquery);
  

RE: [mapguide-users] Thematic Mapping

2009-01-30 Thread Chris Claydon
I would recommend modifying your call to InterpolateColor() so that the start 
color and end color correspond to the colors you want. They are currently both 
set to the same string.

-Original Message-
From: mapguide-users-boun...@lists.osgeo.org 
[mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of padmini godavarthi
Sent: Friday, January 30, 2009 3:59 AM
To: mapguide-users@lists.osgeo.org
Subject: [mapguide-users] Thematic Mapping




Hi,
iam using mpguide opensource 2.0 (.net 2.0 +IIS 5.1).
I want to do thematic mapping for polygon layer(for example parcel layer)
i tried to use the code in dotnetviewer sample.its working fine

iam able to create a thematic layer with same color to the all polygons.
Now my problem is that i want to apply different colours to the different
polygons

for example for parcel_id =1    green colour
for example for parcel_id =2    Red colour and
soon.

for this can u plz tell me the code for how to do it?


my code was as follows
--


NameValueCollection serverVars = Request.ServerVariables;
String strServerVars = ;
foreach (String str in serverVars.AllKeys)
{

strServerVars += br + str;

}
String platform = serverVars[SERVER_SOFTWARE];
String queryStr = serverVars[QUERY_STRING];
string queryStr1 = serverVars[Form];
NameValueCollection requestParams = Request.HttpMethod == POST ?
Request.Form : Request.QueryString;
String sessionId = Request.QueryString[SESSION];
string realPath = Request.ServerVariables[APPL_PHYSICAL_PATH];
String configPath = realPath + webconfig.ini;
MapGuideApi.MgInitializeWebTier(configPath);
MgUserInformation userInfo = new MgUserInformation(sessionId);
MgSiteConnection siteConnection = new MgSiteConnection();
siteConnection.Open(userInfo);
MgResourceService resourceService =
(MgResourceService)siteConnection.CreateService(MgServiceType.ResourceService);
MgFeatureService featureService =
(MgFeatureService)siteConnection.CreateService(MgServiceType.FeatureService);

MgMap map = new MgMap();
map.Open(resourceService, mapdata);
MgLayerCollection layers = map.GetLayers();
MgLayer layer = (MgLayer)layers.GetItem(property layer);

MgResourceIdentifier resId = new
MgResourceIdentifier(layer.GetFeatureSourceId());
MgResourceIdentifier layerDefResId = layer.GetLayerDefinition();
MgByteReader byteReader =
resourceService.GetResourceContent(layerDefResId);

// Load the Layer Definition and Navigate to the specified
VectorScaleRange

XmlDocument doc = new XmlDocument();
String xmlLayerDef = byteReader.ToString();
doc.LoadXml(xmlLayerDef);
  XmlNodeList nodeList =
doc.GetElementsByTagName(VectorScaleRange);

XmlElement vectorScaleRangecElement = (XmlElement)nodeList.Item(0);
XmlElement areaTypeStyle =
(XmlElement)vectorScaleRangecElement.GetElementsByTagName(AreaTypeStyle).Item(0);

// Remove any existing AreaRule elements.

XmlNodeList areaRuleList =
areaTypeStyle.GetElementsByTagName(AreaRule);
int count = areaRuleList.Count;
for (int i = 0; i  count; i++)
{
//The areaRuleList shrinks as we remove items, so always
//remove the first item (don't use the index i)
areaTypeStyle.RemoveChild(areaRuleList.Item(0));
}

// Now create the new AreaRule elements.

String areaRuleTemplate =
File.ReadAllText(GetThemeXmlTemplatePath());
MgFeatureAggregateOptions aggregateOptions = new
MgFeatureAggregateOptions();

String value = null;
String filterText = null;
String areaRuleXML = null;
XmlDocument areaDoc = null;
XmlNode areaNode = null;
double portion = 0.0;

aggregateOptions.AddFeatureProperty(FeatId);
aggregateOptions.SelectDistinct(true);
aggregateOptions.SetFilter(totquery);
  double increment = (5  1) ? 1.0 / (5 - 1) : 1.0;
MgDataReader dataReader = featureService.SelectAggregate(resId,
layer.GetFeatureClassName(), aggregateOptions);
while (dataReader.ReadNext())
{
value = GetFeaturePropertyValue(dataReader, FeatId);

filterText = quot; + FeatId + quot; = ;

filterText = filterText + value;

areaRuleXML = String.Format(areaRuleTemplate,
  FeatId + : + value,
filterText,
InterpolateColor(portion, C2C3C4, C2C3C4, 0), InterpolateColor(portion,
C2C3C4, C2C3C4, 0));
areaDoc = new XmlDocument();
areaDoc.LoadXml(areaRuleXML);
 

RE: [mapguide-users] Thematic Mapping

2009-01-10 Thread padmini godavarthi

Hi,
Thanks for u r reply.
But i want the only codein c sharp for applying theme.
Can u plz send me the code . 


Regards,
Padmini.


Chris Claydon wrote:
 
 Most of the interesting code for the Theme sample is in the files
 thememain.aspx and classes/theme.aspx
 
 Thememain.aspx handles most of the UI
 Theme.aspx contains the methods to retrieve required information from
 MapGuide, and to generate the new themed layer.
 
 The key method is ApplyTheme() which retrieves an existing MapGuide layer
 definition, removes the existing theme configuration, and replaces it with
 the one defined by the user. It then adds this new layer definition to the
 map so that it can be displayed.
 
 I would highly recommend consulting the MapGuide Web Tier API
 documentation to help in understanding the code.
 
 Chris.
 
 -Original Message-
 From: mapguide-users-boun...@lists.osgeo.org
 [mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of padmini
 godavarthi
 Sent: Thursday, January 08, 2009 11:54 PM
 To: mapguide-users@lists.osgeo.org
 Subject: [mapguide-users] Thematic Mapping
 
 
 
 Hi,
 iam using Mapguide opensource 2.0 (with .net 2.0 (C#) and IIS 5.1)
 Now i want to do the thematic mapping based on parcel id programmetically.
 i saw dotnetviewersample application (Theme)its working fine.
 but i didn't get the flow of the concept
 can any one plz tell me the procedure and explain the thematic concept in
 dotnetviewer sample application so that it will be very helpful to me.
 
 
 Thanks and Regards,
 Padmini.
 --
 View this message in context:
 http://n2.nabble.com/Thematic-Mapping-tp2132051p2132051.html
 Sent from the MapGuide Users mailing list archive at Nabble.com.
 
 ___
 mapguide-users mailing list
 mapguide-users@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/mapguide-users
 ___
 mapguide-users mailing list
 mapguide-users@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/mapguide-users
 
 

-- 
View this message in context: 
http://n2.nabble.com/Thematic-Mapping-tp2132051p2137063.html
Sent from the MapGuide Users mailing list archive at Nabble.com.

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


RE: [mapguide-users] Thematic Mapping

2009-01-10 Thread Andy Morsell
You already have the code.  Please just dig a little deeper into it before
posting questions.  If you don't have the code, download the
dotnetviewersample.zip file from
http://mapguide.osgeo.org/download/releases/2.0.x-samples.  Unzip the file.
Look in the THEME folder.  As Chris already said, look in the thememain.aspx
and classes/theme.aspx files.  Those files are all written in C#.  From here
you have everything you need but it will require a little work on your part
to read, understand and disseminate the code and put it to use in your own
application.

Andy Morsell, P.E.
Spatial Integrators, Inc.
www.SpatialGIS.com


-Original Message-
From: mapguide-users-boun...@lists.osgeo.org
[mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of padmini
godavarthi
Sent: Saturday, January 10, 2009 12:24 AM
To: mapguide-users@lists.osgeo.org
Subject: RE: [mapguide-users] Thematic Mapping


Hi,
Thanks for u r reply.
But i want the only codein c sharp for applying theme.
Can u plz send me the code . 


Regards,
Padmini.


Chris Claydon wrote:
 
 Most of the interesting code for the Theme sample is in the files
 thememain.aspx and classes/theme.aspx
 
 Thememain.aspx handles most of the UI
 Theme.aspx contains the methods to retrieve required information from
 MapGuide, and to generate the new themed layer.
 
 The key method is ApplyTheme() which retrieves an existing MapGuide layer
 definition, removes the existing theme configuration, and replaces it with
 the one defined by the user. It then adds this new layer definition to the
 map so that it can be displayed.
 
 I would highly recommend consulting the MapGuide Web Tier API
 documentation to help in understanding the code.
 
 Chris.
 
 -Original Message-
 From: mapguide-users-boun...@lists.osgeo.org
 [mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of padmini
 godavarthi
 Sent: Thursday, January 08, 2009 11:54 PM
 To: mapguide-users@lists.osgeo.org
 Subject: [mapguide-users] Thematic Mapping
 
 
 
 Hi,
 iam using Mapguide opensource 2.0 (with .net 2.0 (C#) and IIS 5.1)
 Now i want to do the thematic mapping based on parcel id programmetically.
 i saw dotnetviewersample application (Theme)its working fine.
 but i didn't get the flow of the concept
 can any one plz tell me the procedure and explain the thematic concept in
 dotnetviewer sample application so that it will be very helpful to me.
 
 
 Thanks and Regards,
 Padmini.
 --
 View this message in context:
 http://n2.nabble.com/Thematic-Mapping-tp2132051p2132051.html
 Sent from the MapGuide Users mailing list archive at Nabble.com.
 
 ___
 mapguide-users mailing list
 mapguide-users@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/mapguide-users
 ___
 mapguide-users mailing list
 mapguide-users@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/mapguide-users
 
 

-- 
View this message in context:
http://n2.nabble.com/Thematic-Mapping-tp2132051p2137063.html
Sent from the MapGuide Users mailing list archive at Nabble.com.

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

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


RE: [mapguide-users] Thematic Mapping

2009-01-09 Thread Chris Claydon
Most of the interesting code for the Theme sample is in the files 
thememain.aspx and classes/theme.aspx

Thememain.aspx handles most of the UI
Theme.aspx contains the methods to retrieve required information from MapGuide, 
and to generate the new themed layer.

The key method is ApplyTheme() which retrieves an existing MapGuide layer 
definition, removes the existing theme configuration, and replaces it with the 
one defined by the user. It then adds this new layer definition to the map so 
that it can be displayed.

I would highly recommend consulting the MapGuide Web Tier API documentation to 
help in understanding the code.

Chris.

-Original Message-
From: mapguide-users-boun...@lists.osgeo.org 
[mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of padmini godavarthi
Sent: Thursday, January 08, 2009 11:54 PM
To: mapguide-users@lists.osgeo.org
Subject: [mapguide-users] Thematic Mapping



Hi,
iam using Mapguide opensource 2.0 (with .net 2.0 (C#) and IIS 5.1)
Now i want to do the thematic mapping based on parcel id programmetically.
i saw dotnetviewersample application (Theme)its working fine.
but i didn't get the flow of the concept
can any one plz tell me the procedure and explain the thematic concept in
dotnetviewer sample application so that it will be very helpful to me.


Thanks and Regards,
Padmini.
--
View this message in context: 
http://n2.nabble.com/Thematic-Mapping-tp2132051p2132051.html
Sent from the MapGuide Users mailing list archive at Nabble.com.

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