Hi,
I noticed that there is the thinkgeo logo in the map control. Can I remove it? Or, replace with our own logo?
Hi,
I noticed that there is the thinkgeo logo in the map control. Can I remove it? Or, replace with our own logo?
Ivan,
Currently in the Web Edition you cannot remove the logo. We did add a property to remove it in the Services Edition however we overlooked that property in the Web Edition. We will have a new public release next week with that feature added. In regards to adding your own logo I will do some research and get back with you soon.
David
Ivan,
I verified the field to remove the logo is actually internal however I am going to send a little code that will enable you to set the value regardless of its accessibility level. The sample will be ready soon. On using your own logo I am still checking on the best way, waiting to hear back from someone.
David
Ivan,
Below is some code to remove the logo through reflection. In the near future this may break as we might change the property name and change its accessibility level.
(Add this to your page load when it is not a post-back.)
using System.Reflection;
using ThinkGeo.MapSuite.WebEdition;
System.Type type = Map1.GetType();
PropertyInfo propertyInfo = type.GetProperty("Logo", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
PredefinedControl Logo = (PredefinedControl)propertyInfo.GetValue(Map1,null);
Logo.Enabled = false;
David
Ivan,
The code below can be added to your web page. You do not need to add the cc1:Map control but I wanted to add this to show you that you need to add the script section BELOW the map control for things to work right. Note that for this to work you should not use the trick I showed you in the previous post. If you use the code from the previous post you will not see any logo at all, this javascript replaces our logo with your own. Also note that in the javascript that the 7th line from the bottom has an issue. It should be [0] but from some reason it didn't format correctly so I used [ 0].
<cc1:Map ID="Map1" runat="server" Width="100%" Height="100%">
</cc1:Map>
var newLogo = "";
function changeLogo(){
var map = Map1.GetOpenLayersMap();
if(map.layers.length == 0)
{
Map1.GetMapParser().attribution = newLogo;
}
else
{
for(var i=0; i<map.layers.length; i++)
{
map.layers[i].attribution = newLogo;
var logo = map.getControlsByClass("OpenLayers.Control.Attribution")[ 0];
logo.updateAttribution();
}
}
}
Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(changeLogo);
Unfortunately, both method seems not working to me. Perhaps I will wait for your new release next week then. Thanks
I am not sure why the first method did not work. I did this test with our public release on a clean machine. In any event once thing I think I did mention wrong is that you should always call this code on the page load, on post-back and non post-back.
In any event the new build will be out shortly and the show logo is settable.
David
Same here,
THe javascript is not working.
Strange, I will test it with a clean machine. In any event we will have better support for this in the new release due out Monday. I will test it there to ensure I know how it works.
David
I noticed that the new beta allow the ability to turn the logo on and off.
How should i add in a new logo ?
Thanks!
Here is how to add customer logo in the new version.
In the Code behind, you should add the following in the page load:
Map1.ShowLogo = false;
In the page, you should add the following javascript in header tag (put your logo inner html as a parameter to the constructor where is says your own logo):
< script type="text/javascript">
function onMapCreated(map)
{
map.addControl(new OpenLayers.Control.Logo('your own logo'));
}
< /script>
David
Where is the javacript ?
Kwong
Kwong,
I edited Dave's post so the Java script now displays.
Thanks!
I have the latest beta version (3.0.117.0) from what I can tell.
But I don’t see any properties to disable or enable the logo. How do I do it?
In 3.0.117, we have APIs to control the logo as following.
Map1.MapTools.Logo.Enabled
Map1.MapTools.Logo.ImageUri
Also here is a sample shows how to turn on/off the logo.
PS: we will have a new public release tomorrow, we have fixes couples of bugs in that version and please have a try.
Ben
159-Post4280.zip (94.6 KB)
Ben,
Thanks for the sample but I am still having issues getting my logo to display. I am using the DisplayASimpleMap sample app and in the Page_Load I am calling the following:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
Map1.MapBackground.BackgroundBrush = New GeoSolidBrush(GeoColor.FromHtml("#B3C6D4"))
'Map1.CurrentExtent = New RectangleShape(-140, 60, 140, -60)
Map1.MapUnit = GeographyUnit.DecimalDegree
' The following two lines of code enable the client and server caching.
' If you enable these features it will greatly increase the scalability of your
' mapping application however there some side effects that may be counter intuitive.
' Please read the white paper on web caching or the documentation regarding these methods.
' Map1.StaticOverlay.ClientCache.CacheId = "WorldOverlay"
' Map1.StaticOverlay.ServerCache.CacheDirectory = MapPath("~/ImageCache/" + Request.Path)
Dim stateLayer As New ShapeFileFeatureLayer("C:\Program Files\ThinkGeo\Map Suite Web Full Edition 3.0\Samples\VB Samples\SampleData\USA\states.shp")
stateLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(255, 243, 239, 228), GeoColor.FromArgb(255, 218, 193, 163), 1)
stateLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20
Map1.StaticOverlay.Layers.Add(stateLayer)
Dim uri As New Uri("C:\Program Files\ThinkGeo\Map Suite Web Full Edition 3.0\Samples\VB Samples\theme\default\img\powerbythinkgeo.gif")
Dim uri2 As New Uri("gis.thinkgeo.com/Portals/1/ActiveForums_Avatars/Avatar_8.png")
Map1.MapTools.Logo.Enabled = True
Map1.MapTools.Logo.ImageUri = uri
'Map1.MapTools.Logo.ImageUri = uri2
stateLayer.Open()
Map1.CurrentExtent = stateLayer.GetBoundingBox()
stateLayer.Close()
End If
End Sub
The URI I am using points to the same image that is used for the default ThinkGeo logo yet I cannot get it to display as shown below:
URI2 works as expected. Any ideas on why the image on my local machine would not work?
Steve,
The logo image must be with a virtual path related to the server. Right click the logo image and choose the “properties”, you can find the physical path is specified to client’s machine, that’s why it cannot find that image. Here is the correct code.
Map1.MapTools.Logo.Enabled = True
Map1.MapTools.Logo.ImageUri = New Uri(Request.Url, “/theme/default/img/powerbythinkgeo.gif”)
Thanks,
Ben
Are there any limits on the size for the logo?
The logo is included in an "img" tag, there is no limits on its size, neither on the width/height size nor the file size.
Ben