This project is read-only.

"Hello world" code for Brutile DotSpatial integration

Jan 12, 2012 at 4:05 PM

Dear all,

is there an "Hello world" code for Brutile DotSpatial integration? Just an example with a Map component and a Brutile Layer.

Thank you,

Andrea

Jan 23, 2012 at 7:27 PM

This would be nice. 

I could try to work on something such as this, but there are no promises that it would work seamlessly. 

Jan 24, 2012 at 9:16 PM

I will wait for you, it would be great!

Jan 27, 2012 at 9:49 PM

I have added a tutorial that shows how to get the WebMap extension. I'm not sure whether this will help you.

http://mudnug.wordpress.com/2012/01/27/finding-and-installing-the-webmap-extension/

Jan 29, 2012 at 9:40 PM

Hu mudnug,,
first of all thank for your time.

I have just read your blog post, but I do not know if it will help me. My goal is to insert in a simple app that we are trying to develop the WebMap toolbar.
In this image our app, and the place where we could insert WebMap toolbar: http://i.minus.com/irWEQNGf4XEgz.png

We would like to have it as default tool and not to load it using Extension Manager. Moreover we are not using in this moment the "File menu" useful to load Extension Manager.

Probably our goal is a simple one, but in this moment we are not able to load extension manager with "our" toolbar.

 

Best regards,

Andrea

Jan 30, 2012 at 5:21 PM

We have a simple app that uses BruTile outside of the WebMap plugin.  Very much along the lines of a "Hello World" example.

You can download the DotSpatial BruTile layer here:

http://groups.google.com/group/dotspatial-dev/browse_thread/thread/5e8942d43c5b653e?pli=1

 

In the Form_Load

            ToolStripDropDown tsDropDown = new ToolStripDropDown();
            ToolStripDropDownButton tsDropDownButton;
            tsDropDownButton = new ToolStripDropDownButton("Map Type");
            tsDropDownButton.DropDown = tsDropDown;
            tsDropDown.Items.Add("None", null, tsDropDown_OnClick);
            tsDropDown.Items.Add("Google Satellite", null, tsDropDown_OnClick);
            tsDropDown.Items.Add("Google Map", null, tsDropDown_OnClick);
            tsDropDown.Items.Add("Yahoo Map", null, tsDropDown_OnClick);
            toolStripCTS1.Items.Add(tsDropDownButton);

In the tsDropDown_OnClick event

        private void tsDropDown_OnClick(object sender, EventArgs e)
        {
            ToolStripItem tsItem = sender as ToolStripItem;

            Cursor tmpCursor = Cursor.Current;            
            Cursor.Current = Cursors.WaitCursor;
            Application.DoEvents();
            try
            {

                map1.MapFrame.SuspendEvents();
                if (_btLayer != null)
                {

                    map1.Layers.Remove(_btLayer);
                    _btLayer = null;
                }

                if (String.Compare(tsItem.Text, "Google Satellite", true) == 0)
                {
                    _btLayer = BruTileLayer.CreateGoogleAerialLayer();
                    _btLayer.LegendText = "Google Satellite";
                    map1.Layers.Add(_btLayer);
                }
                else if (String.Compare(tsItem.Text, "Google Map", true) == 0)
                {
                    _btLayer = BruTileLayer.CreateGoogleMapLayer();
                    _btLayer.LegendText = "Google Map";
                    map1.Layers.Add(_btLayer);
                }
                else if (String.Compare(tsItem.Text, "Yahoo Map", true) == 0)
                {
                    _btLayer = BruTileLayer.CreateYahooMapLayer();
                    _btLayer.LegendText = "Yahoo Map";
                    map1.Layers.Add(_btLayer);
                }


                else if (String.Compare(tsItem.Text, "None", true) == 0)
                {

                }

                map1.MapFrame.ResumeEvents();
            }

Hope this helps.
Kurt

 

Jan 30, 2012 at 5:47 PM

I'll also write a tutorial that illustrates how to use the current extension in your toolbar (in case that is what you want).

Jan 30, 2012 at 5:52 PM

Hi Kurt,
you are very kind. Thank you very much.

I'll try your code as soon as possible, and I will write you.

Best regards and once again thank you,

a

Jan 30, 2012 at 5:57 PM

Hi Mudnug,
you are very kind too, and this second tutorial would be a big present for me.

 

Do it only if you have the time and if it's very easy for you.
Best regards,
Andrea
Jan 31, 2012 at 12:45 AM

Here's the tutorial http://wp.me/pvy5A-2v. I realized this can be an expansive topic, so my initial comments are somewhat limited. Let me know if you need more information.

Jan 31, 2012 at 8:27 PM

Hi mudnug,
I have no words, thank you very much.

I will make a test as soon as pobbile.

Best regards,

a

Feb 2, 2012 at 4:46 PM

it works great but Extreemly slow

it takes about 10 sec to zoom in

Feb 2, 2012 at 6:31 PM

That sounds rather slow. Are you referring to the 2010  BruTile layer? We sped it up when we pulled it into an extension for DotSpatial.

Feb 2, 2012 at 10:03 PM
Edited Feb 2, 2012 at 11:10 PM

@LiFo

You may have to disable automatic detection of proxy in you internet-explorer settings

@mudnug:

Sped up doing what?

Feb 3, 2012 at 3:32 PM
FObermaier wrote:

@LiFo

You may have to disable automatic detection of proxy in you internet-explorer settings

@mudnug:

Sped up doing what?

Got it to work with disabling the automatic detextion of proxy

but that is a workaround not a solution, i can't ask all people to do the same

i used the BruTileLayer Control

BruTile version 0.5.2.0
DotSpatial from changset 1559 

the only thing i changed in BruTileLayer is 

_projection.ReadEpsgCode(epsgCode);
to
_projection = ProjectionInfo.FromEpsgCode(epsgCode);

 

maby i should try with the latest BruTile source

but i would like to get a "Hello World" excample on how to use the WebMap plug-in through code and not drag & drop

 

 

Feb 3, 2012 at 4:28 PM

Some changes have been made in BruTile to address the auto proxy detection performance issues.  I think I heard that these changes might be redone in favor of a cleaner approach,, but that the performance issues would still be addressed.  Anyway, it would be worth a try to see if you can get it to work with the latest BruTile.  You might have to make some code adjustments to get your code that is consuming BruTile to build.

Kyle

Feb 19, 2014 at 9:30 AM
Edited Feb 19, 2014 at 9:30 AM
but what is this _btLayer? Where should i define it in my C# code or is it a layer?