ThinkGeo.com    |     Documentation    |     Premium Support

InMemoryMarkerOverlay with two image marker

hi i wants to show two images on InMemoryMarkerOverlay basically i have two types of data into my database one is male and second si female on this i wants to show male for different image and female also with different image my code is.

 if (query.strAnswer == “19302”)

                {

                   

                    myFeature =

                 new Feature(Convert.ToDouble(Long),

                     Convert.ToDouble(Lat));

                    myData.EditTools.Add(myFeature);

                    StringBuilder contentHtml = new StringBuilder();



                    contentHtml.Append(

                        "
                        .Append(

                            “src=’…/…/theme/default/samplepic/lawrencecity.jpg’/>  Lawrence is a city in Northeastern Kansas”)

                        .Append(

                            "in the United States. Lawrence serves as the county seat of Douglas County, Kansas. Located 41 miles west ")

                        .Append(

                            "of Kansas City, Lawrence is situated along the banks of the Kansas (Kaw) and Wakarusa Rivers. It is considered ")

                        .Append(

                            "governmentally independent and is the principal city within the Lawrence, Kansas, Metropolitan Statistical Area, “)

                        .Append(

                            “which encompasses all of Douglas County. As of the 2000 census, the city had a population of 80,098, making it “)

                        .Append(

                            “the sixth largest city in Kansas. 2006 estimates[3] place the city’s population at 89,110. A quintessential”)

                        .Append(

                            “college town, Lawrence is home to The University of Kansas and Haskell Indian Nations University.
”)

                        .Append(”  
                        .Append(“target=’_blank’>
more about Lawrence city…”);

                    markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.WebImage =

                        new WebImage(”/a.png”, 30, 30);

                    markerOverlay.FeatureSource.InternalFeatures.Add(myFeature);

            

                    markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.Popup.ContentHtml = contentHtml.ToString();

                    markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.Popup.Width = 450;

                    markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.Popup.Height = 290;

                    markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.Popup.IsVisible = false;

                    markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.Popup.AutoPan = true;

                    markerOverlay.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

                }

                else

                {

                   

                    myFeature =

                    new Feature(Convert.ToDouble(Long),

                        Convert.ToDouble(Lat));

                    myData.EditTools.Add(myFeature);

                    StringBuilder contentHtml = new StringBuilder();



                    contentHtml.Append(

                        "
                        .Append(

                            “src=’…/…/theme/default/samplepic/lawrencecity.jpg’/>  Lawrence is a city in Northeastern Kansas”)

                        .Append(

                            "in the United States. Lawrence serves as the county seat of Douglas County, Kansas. Located 41 miles west ")

                        .Append(

                            "of Kansas City, Lawrence is situated along the banks of the Kansas (Kaw) and Wakarusa Rivers. It is considered “)

                        .Append(

                            “governmentally independent and is the principal city within the Lawrence, Kansas, Metropolitan Statistical Area, “)

                        .Append(

                            “which encompasses all of Douglas County. As of the 2000 census, the city had a population of 80,098, making it “)

                        .Append(

                            “the sixth largest city in Kansas. 2006 estimates[3] place the city’s population at 89,110. A quintessential”)

                        .Append(

                            “college town, Lawrence is home to The University of Kansas and Haskell Indian Nations University.
”)

                        .Append(”  
                        .Append(“target=’_blank’>
more about Lawrence city…”);

                    markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.WebImage = new WebImage(”/b.png”, 30, 30);

                    markerOverlay.FeatureSource.InternalFeatures.Add(myFeature);



                    markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.Popup.ContentHtml = contentHtml.ToString();

                    markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.Popup.Width = 450;

                    markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.Popup.Height = 290;

                    markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.Popup.IsVisible = false;

                    markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.Popup.AutoPan = true;

                    markerOverlay.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

                }

but only    markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.WebImage =

                        new WebImage(”/a.png”, 30, 30); this image is display on my all data both male and female .

how can i achieved this please help

Hi Raja,



It always shows the a.png is because one feature marker has only one marker image and the definition on the WebImage will be override if defining multi times.



Currently, I can figure out an option but not sure if it meets for you. Since one marker is mapping one image, I think we can add two features with a same position to represent a male and a female. Then we give an offset on the markers to avoid cover each other. 



Thanks,

Troy


hi i figure it out one more problem with hoverover marker popup, actually in this code

 StringBuilder contentHtml = new StringBuilder();

                    myFeature =

                 new Feature(Convert.ToDouble(Long),

                     Convert.ToDouble(Lat));

                    myData.EditTools.Add(myFeature);

                 

                    string ImageUrl = string.Empty;



                    ImageUrl = “/ftp/pictures/” + picture.strAnswer;

                    

                  //  contentHtml.Append(“Picture”)





                        contentHtml.Append("")

                        .Append("
")

          .Append(“Date:  “)



                   .Append(”” + Date.strAnswer + “”);



                    markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.WebImage =

                        new WebImage("/a.png", 30, 30);

                  

                  

                    markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.Popup.ContentHtml = contentHtml.ToString();

                    markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.Popup.Width = 250;

                    markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.Popup.Height = 290;

                    markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.Popup.IsVisible = false;

                    markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.Popup.AutoPan = true;

                    markerOverlay.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

                    markerOverlay.FeatureSource.InternalFeatures.Add(myFeature);

this is the code and issue is with contenthtml my last contenthtml data is display with all my marker why is that please help




Hi Raja, 
  
 Your code keep modify the markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.Popup.ContentHtml value when you run the loop, so it shows the latest one value. 
  
 You should want to set an column name here, please view the topic here, you should get some helpful information: 
  
 thinkgeo.com/forums/MapSuite/tabid/143/aft/8236/Default.aspx 
  
 Regards, 
  
 Don