Hi,
I've just started looking at this with a view to using it for a project.
I've generally been impressed with the level of functionality available and ease of use, but slightly surprised that certain features that I'd almost expect as standard are missing (or at least I haven't found them yet!). I'm sure that many / all of these can be developed for varying amounts of effort - but before going down that route I'd like to make sure I haven't just missed something.
For example:
- I'm surprised there is no standard toolbar with zoom, info, pan etc that can be dropped on a map - I accept this is pretty easy to do though. Additionally a draw / edit toolbar as well.
- Zoom in (and out) seems to be just on click (or zoom to feature or multiple features). Is there a drag zoom box facility ? and a zoom to layer extent ?
- Slightly more complex to build would be a Layer control to switch on / off layers - especially if this was combined with dynamic legend
- Printing (I have seen the export to PDF which is nice) but a layout that could be annotated / tweaked (and even saved) before printing would be nice
- Finally components to allow users to set colours, fill styles and alter thematics would be useful.
As I said - I suspect much of the functionality is there / can be developed in .NET but it would make development much faster if there were some of these frequently required components immediately available. Most of my users who have used a range of GIS tools over the years expect to see these in a mapping application these days.
Maybe you have code samples that already demonstrate doing some of these things in which case please point me towards them.
Many Thanks
New to Map Suite - can I do this?
J,
I’m a MS user since 2 years and will leave MS support to answer precisely to your needs, but be sure that everything you describe is feasable ; it’s mainly what my application does.
- toolbar: it’s very easy to drive MS for standard actions such as zoom, pan but toolbar depend on your GUI; I’m using DevExpress to get nice toolbar such as Office Ribbon
- drag zoom box is not provided but easy to implement (Check the code community)
- very easy to implement a layer control; I’m using a devexpress treelist
- Color, fill, transparency, thematic is very easy
- a “nice” Printing is much more complex but feasible; printing at a specific scale is feasible and a bit more complex.
Regards,
Patrick.
Thanks Patrick,
I didn't really doubt that most of this was possible (and much of it was indeed quite easy) - I was just surprised that components to do these standard tasks weren't already included to get you started.
Printing maps to scale for example must be something people frequently want to do - and as you say its always fiddly to get it scaled right on the paper.
I really liked the example code supplied to get you started, but I think the software would really benefit form either having these components supplied as standard - or at least some more complex code examples that would allow people to get up and running very quickly.
The fact that you say your application implements most of these sort of proves my point - I would have thought most people would want this - so there must be an enormous amount of duplicate effort going on.
Best wishes
James
First, I would like to put to rest your concerns and asure you that all the functionalities you are looking for are possible to implement with Map Suite, whether out of the box or with various degrees of customization.
I would like to attempt to give you some directions to your questions. That way, at least, you will have an idea of the possiblities of Map Suite and where to find useful development resources.
“- I'm surprised there is no standard toolbar with zoom, info, pan etc that can be dropped on a map - I accept this is pretty easy to do though. Additionally a draw / edit toolbar as well.”
We don’t actually have a standard toolbar with those basic GIS functionalities but you can find in the “How Do I” sample apps and in the projects of the Code Community, the same template for toolbar that has been used for building those apps. For Draw/Edit toolbar, you can check the projects related to editing or tracking shapes to find some examples:
code.thinkgeo.com/projects/s...rackshapes
You can also see the sample Track and edit shapes in the “How Do I” samples under the “Editing Feature Layers” category.
- Zoom in (and out) seems to be just on click (or zoom to feature or multiple features). Is there a drag zoom box facility ? and a zoom to layer extent ?
Of course, “drag zoom box facility” or Track Zoom In is standard feature of Map Suite, simply hold Shift key of your keyboard while dragging the mouse on the map create the zoom in area. Map Suite also gives you the flexibility to customize the behavior of that action as you can see in the project Track Zoom In Without Shift.
code.thinkgeo.com/projects/show/trackzoomwithout
- Slightly more complex to build would be a Layer control to switch on / off layers - especially if this was combined with dynamic legend
- Finally components to allow users to set colours, fill styles and alter thematics would be useful.
That is also possible but with some more custom work. Currently, we have a project Legend Adornment Layer that shows how to build a legend for your layer displayed on the map. Although, it does not show how to switch on/off layers, with a little bit of work on your side you can create your own legend with that capability.
We actually have in plan to add a Legend control to Map Suite Desktop. It will allow to switch on/off layer, change order, set styles, set zoom levels etc. I do not have a date for the release of that feature but this is a project that the development team will work on this year, I believe.
- Printing (I have seen the export to PDF which is nice) but a layout that could be annotated / tweaked (and even saved) before printing would be nice.
As for the Legend control, we have in plan to have in the future a presentation layout that allows putting nicely a title, a framework etc for final presentation to an audience.
If you feel you need more detailed responses on some of your questions, do not hesitate to reply to us.
James,
I can give you some of the insight into why we have or don’t have some of the features. We are always learning from our customers and take their feedback seriously.
Toolbar
In our V2 samples we had a toolbar and then removed it when we went with version three. The main reason is that with version three you can do just about anything with the mouse and it is more like other online maps. You can zoom in using the mouse wheel or double clicking and you can zoom out using the same system. We kind of saw the navigation toolbar going out of fashion and the code to implement it was literally one line of code per button like Map.ZoomIn() etc. The other thing we considered is people using all kinds of various third party controls for toolbar, ribbon bars etc and didn’t see many people using the stock VS toolbar control anymore.
Where I think we can improve is to prove some samples to show a toolbar in action and maybe create a very light weight toolbar control to get people started fast. This way you can see the code and how it works so it would be much easier to transfer the code to your own custom toolbar. The other thing we need to do is have a good zoombar with navigation for the desktop edition. This system is kind of replacing the toolbar for simple movement around the map. Of course you need toolbars or ribbon bars for everything else but we should have a good navigation control.
Drag Zoom Box
We support this by default if you hold down the shift key and draw a rectangle on the screen you will zoom into that area. If you want it as a ‘mode’ then there is a code community project that does just that. What we wanted to get away from were ‘modes’ and allow for a free flow of navigation commands without being in a ‘mode’ in regards to navigation. What always seemed to happened is when we had standard modes people wanted to do that and some other thing at the same time. It was hard to modify to get things exactly the way people wanted them. This is why we introduced the concept of interactive overlays which are overlays that allow you to interact with the mouse and keys. We expose ours overlays and you can overload or replace our and implement your own logic.
Code for Track Zoom Without Shift
code.thinkgeo.com/projects/show/51
Printing
We have quite a few ways to do this. There is the PDF route like you mentioned which is a good way to go. We have also finished up a .Net Printer GeoCanvas that prints directly to the .net printer object. You can get that through the daily developer builds. I think it is called PrinterGeoCanvas or something. Printing is something that everyone does differently and is hard to find a one size fits all. I think the lesson though is that we should have at least a baseline for this better defined and more samples around printing.
Set Colors & Styles
This is something we have wanted to do for some time but there were some limitation on it. The idea would be to create something that could be re-used by other developers and integrated into their applciations. With Winforms there is a limited ability to alow people to customize the look and feel of the dialogs. I have always felt that many of the pre-built dialogs in many applications looked hokey and wanted to do this in WPF where it could be easily skinned. We have a group working on these for WPF as part of a larger project but we will post these dialogs as they come to shape.
I think the short sightedness we have had was not a not so great sample was worse than no sample. We always want to put something out really good and not good enough. We have had a bunch of people ask for the MapSuite Explorer code that has many of these items in it. We never thought it was good enough or modular enough to post but I think that was short sighted. We have gotten allot of good feedback t suggest we should post it. I think this will help you out.
Legend
I will let Val address this. We had some in the past with version two put I thought it looked bad and is hard to create a really good one that can satisfy everyone’s needs. I will look to posting the code for hte old one and also when we expose the Map Suite Explorer it will contain a legend which is more of a layer switcher.
Documentation
Even though you didn’t mention it directly that is the elephant in the room. We have gotten some feedback about documentation and we are working towards it. The rational in the past has been that there seems to be certain developer identities out there. Each type uses different types of resources to get to their solution. According to some trusted sources 70% of developers will never read documentation no matter how useful it would be to them. For these users they like code examples and rather post items to a forum and get group support. On the opposite end of the spectrum there is a 5-10% of developers who read the documentation first and are not that interested in code samples as they can figure out all the plumbing from some very terse examples with good documentation. They spend 80% of the time researching and 20% implementing. The third personality is between the two. The point is that we have really been focusing on the 70% with our limited resources but the time has come to get the other groups.
Anyway I have put this out here to give you guys some insight and also to generate some conversation. I think one big advantage of working with Map Suite is you have very direct access to people who can make a difference with the product. We can’t always get in everything people want but we are more than happy to have the discussion and to see what we can do if people make a compelling case. We are working hard to make things more transparent to our customers and to make our weaknesses our strengths.
David
David / Val,
Many thanks for the candid replies - its much appreciated - I will work my way through the detail.
I appreciate that its difficult / impossible to satisfy everyone. I would put myself closer to the 70% in Davids example - though I do dip into documentation to clarify things - but I'm not someone who would normally start on page 1. For me code examples are a great way in.
I have a fair few years experience using and developing in a wide range of GIS/mapping applications over the years - both commercial and open source so I suppose some of the items I was questioning were things that jumped out at me as not being immediately apparent as I was used to finding them in other packages.
I can also see that you might not want to offer componets for e.g. printing and layer controls / legends if you are not entirely happy with them, but it did seem to me that you had slightly dipped out of the whole interface side of things altogether - concentrating primarily on the engine. I do think this is a slight mistake - and if you don't want to offer them as proper drop on controls I think offering some pretty sophisticated code examples that people could effectively take and either re-use as is - or customise if they wanted - would be a great addition.
I (and I'm sure others) come to your software looking for a relatively quick solution to part of a bigger development project. In the first instance I need to prove to myself and others that this is a sensible and viable route - and anything that can be done to help getting up and running quickly is a real benefit. I don't care if the legend / layer control / print is styled exactly as I might like it to look - but I do need to mock up enough to show that in principle it works and you can print to scale / have users control thematics etc etc. Once past the proof of concept - there is time to re-visit these elements and either tweak your examples or even re-write from scratch.
Thanks again for your help and suggestions - its nice to see comprehensive prompt replies on a forum
Best wishes
James
James,
Thanks for your interests in Map Suite.
As a developer for Map Suite components, I just say something from my understanding maybe not completely right. I think the Map Suite components basically is designed for a middleware component which is used to develop mapping and GIS application, while its self is not a pure GIS application. Personally speaking, I think Map Suite component is now very powerful and easy to use and extend. Most of various requirements can be accomplished by extending map suite component easily.
Any more questions just feel free to let me know.
Yale
Yale,
Thanks - I wasn’t expecting MapSuite to be an “out of the box” GIS - but rather a light weight development component that can easily be developed to allow users access to spatial data - which I think it is.
I agree from my very quick preliminary look - it does seem powerful and quite easy to work with - in a few hours I have developed an application displaying my map data and allowing pulling together of data from various sources. I have worked with components such as ArcObjects and MapX in the past as well as various Open source equivalents.
The potential attraction of MapSuite for the current project is its read / write to SQL server 2008, consuming WMS services and a free runtime deployment. However I need to be able to demonstrate that it can fulfill our requirements - before getting the go ahead to purchase, and my point was simply that it would have made my life easier if there were some examples for things like layer control / thematics / print layout that I could have quickly dropped onto a prototype rather than having to develop this commonly required functionality from scratch.
However the main thing I have been testing is the SQL 2008 access - as this is key. I also need to convince people that the speed of display on large datasets is acceptable. I see from the forums that there have been a number of posts on this - and I have been working through these seeing if I can optimise things. Like others I’ve found the initial draw time - especially when zoomed out a bit slow - but it gets better when zoomed in - though I’m not yet sure if I have caching working properly.
As an aside - and at the risk of thread drift - how does it handle record locking when you start editing SQL objects in a spatial environment - is there a way to control this ?
Thanks
James,
On the editing side with SQL I can explain how this is handled. We are flexible and if what is happening is not exactly what you need we can work with you to implement something tailored to your needs. Ok with that aside the first concept is that when you begin a transaction, add, delete update etc we cache all of that in memory and do not go to the database until you call the commit transaction. In our editing system we have a transaction buffer object and add you add, delete etc we update some collection on that buffer. When you call commit transaction we will pass those buffers to the CommitTransactionCore. For the SQL FeaureSource what we did was to execute each change separately and the results are stored in the TransactionResults which is passed back in result of the CommitTransaction. This result will let you know which records failed and why. As you can see we are not wrapping this in a SQL transaction proper and we are not locking as you call the add, delete or edit. There is also a property on the edit tools called IsLiveTrasnaction or IsTransactionLive and what this does is if true we will always intercept your results when you do any kind of query such as get features in bounsing box and remove items in the current transaction delete buffer or add records you have in the add buffer if they are n the current extent. in this way you can see your changes take effect even though you have not committed them. If you call rollback we simple clear out our in memory buffers and that’s it. Using this whole system allows us to simulate transactions for things like shapefiles etc and is a nice generic way to handle thing.
Having said all that above we are also flexible to handle real transaction if necessary. If you want to commit all the items as one transaction we can look into that. If you want to start the transaction when we call the begin Transaction and then call the insert and updates when the user calls them that is possible also. We are open to new ideas. We can either enhance the current bits or work with you to create a custom implementation that handles you scenario. I think the biggest advantage to Map Suite is that we have such a well designed API in terms of customization. One other item coming down the pipe shortly is out Source Code Kit which is a separate purchase but makes available a good number of our class for modification and extension. I know the SQL featuresource and layer are in that. Of course we can do pretty much whatever you want without going there but wanted to mention it.
David
David,
Thanks for the reply again. I'm gradually making progress.
I've just grabbed the latest build and found the PrintGeoCanvas object - which looks as if it could be really useful. I'm struggling slightly how to use ith though !
Do you have an example to get started with this ? I'm particulalry interested in e.g. getting a map on a print preview that will output to the bit of paper at a defined scale (e.g. 1:10,000)
Thanks
James
James,
Please try the following codes to print the layers in the MapEngine(mapEngine), the map here is a picture box used to show the map:
private void btnToPrinter_Click(object sender, EventArgs e)
{
PrinterGeoCanvas printerGeoCanvas = new PrinterGeoCanvas();
Collection<SimpleCandidate> labelsInLayers = new Collection<SimpleCandidate>();
PrintDocument document = new PrintDocument();
printerGeoCanvas.DrawingArea = new Rectangle(0, 0, map.Width, map.Height);
printerGeoCanvas.BeginDrawing(document, mapEngine.CurrentExtent, GeographyUnit.DecimalDegree);
foreach (Layer layer in mapEngine.StaticLayers)
{
layer.Open();
layer.Draw(printerGeoCanvas, labelsInLayers);
layer.Close();
printerGeoCanvas.Flush();
}
printerGeoCanvas.EndDrawing();
}
Any more questions just feel free to let me know.
Thanks
Yale
Thanks Yale,
I have that working in a basic fashion but ..
1) Can I direct this to the printDialog (I seem to be getting in a loop trying to do this). I have the basic printDialog example working passing an image - but when I try and use PrintGeoCanvas I'm getting in a mess - or is this not possible with the printerGeoCanvas ?
2) I can't work out how to use some of the other methods - e.g.: printerGeoCanvas.DrawScreenImage it takes a GeoImage - but where do I get that from?
Ultimately I need to achieve two things here:
1) Print to scale (i.e. accurate scaling on bit of paper)
2) Ideally an editable print layout where users can stick their own titles, add legends etc
All possible I'm sure - but some of it may require a bit of effort I fear
Best wishes
James,
1) Following code shows you how to use the PrintPrview. Of course, you could add more of them to respond the buttons on the Preview.
private void btnPreview_Click(object sender, EventArgs e)
{
PrintPreviewDialog dialog = new PrintPreviewDialog();
dialog.Document = new PrintDocument();
PrinterGeoCanvas printerGeoCanvas = new PrinterGeoCanvas();
Collection<SimpleCandidate> labelsInLayers = new Collection<SimpleCandidate>();
PrintDocument document = dialog.Document;
printerGeoCanvas.DrawingArea = new Rectangle(0, 0, 579 * 4, 397 * 4);
printerGeoCanvas.BeginDrawing(document, mapEngine.CurrentExtent, GeographyUnit.DecimalDegree);
foreach (Layer layer in mapEngine.StaticLayers)
{
layer.Open();
layer.Draw(printerGeoCanvas, labelsInLayers);
layer.Close();
printerGeoCanvas.Flush();
}
dialog.ShowDialog();
}
2) The use of PrintGeoCanvas is almost the same with other canvas such as GdiPlusGeoCanvas and PdfGeoCanvas. Following code snippets shows how to get a GeoImage from a file or from an existing bitmap.
GeoImage image = new GeoImage(@"..\..\SampleData\Data\United States.png");
MemoryStream stream = new MemoryStream();
bitmap.Save(stream,System.Drawing.Imaging.ImageFormat.Png);
GeoImage image = new GeoImage(stream);
The magic of setting the layout is try to set the DrawingArea which reflects the target area on the print paper. Try to set different values for it to see its different effects.
Of course, the new feature is developed recently and I also doubt there are couple of ways maybe bugs hidden it, thanks for your any suggestions.
Any more questions just feel free to let me know.
Thanks.
Yale
Thanks Yale,
Ok - I’ve got that going (I was doing an geoCanvas.EndDrawing which casues teh dalog to loop)
I’m still a bit confused as to how to use methods such as:
printerGeoCanvas.DrawWorldImage(img, 200000, 200000, 100000, DrawingLevel.LevelTwo, 50, 50, 0)
I’ve tried getting an img from my current map - and then used DrawWorldImage - which looks as if I can centre it and scale it a bit - but I’m just getting a blank print.
Also I’m not really understanding how / why I supply an image (of e.g. my current map view) and then also set a world X,Y - what happens if my image doesn’t cover that part of the world?
Or have I got this alll wrong and in fact what you are doing is setting the paper in world coordinates in some way?
Thanks
James,
Thanks for your post.
If you want to use the PrinterGeoCanvas to draw directly, you have to use three steps:
1) Begin drawing
2) DrawImage
3) EndDrawing.
In the second step, you can call DrawWorldImage or DrawScreenImage, for worldImage, you have to pass in the coordinate in world coordinate, while draw screen image, you need to pass in the screen coordinate which would be much easier.
The other way I suggested is to use the layer draw instead of Canvas Draw directly, Following codes show you how to add many layers include a ecw world layer to map engine and then use the method above to draw it to printerGeoCanvas, this way would be much easier, you can ignore all this coordinate stuff which may stuck you somehow.
mapEngine.CurrentExtent = new RectangleShape(-135.47672664498, 53.1062529845545, -76.20327335502, 12.4645242175181);
mapEngine.BackgroundFillBrush = new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean);
EcwRasterLayer worldImageLayer = new EcwRasterLayer(@"..\..\SampleData\World.ecw");
ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(@"..\..\SampleData\Countries02.shp");
worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1;
worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.OutlinePen.StartCap = DrawingLineCap.Round;
worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.OutlinePen.EndCap = DrawingLineCap.Round;
worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
ShapeFileFeatureLayer usStatesLayer = new ShapeFileFeatureLayer(@"..\..\SampleData\USStates.shp");
usStatesLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.State2;
usStatesLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.OutlinePen.StartCap = DrawingLineCap.Round;
usStatesLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
ShapeFileFeatureLayer worldCapitalsLayer = new ShapeFileFeatureLayer(@"..\..\SampleData\WorldCapitals.shp");
worldCapitalsLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.Capital3;
worldCapitalsLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
ShapeFileFeatureLayer worldCapitalsLabelsLayer = new ShapeFileFeatureLayer(@"..\..\SampleData\WorldCapitals.shp");
worldCapitalsLabelsLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.Capital3("city_name");
worldCapitalsLabelsLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle.SuppressPartialLabels = true;
worldCapitalsLabelsLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
InMemoryFeatureLayer inMemoryLayer = new InMemoryFeatureLayer();
inMemoryLayer.InternalFeatures.Add("Polygon", new Feature(BaseShape.CreateShapeFromWellKnownData("POLYGON((10 60,40 70,30 85, 10 60))")));
inMemoryLayer.InternalFeatures.Add("Multipoint", new Feature(BaseShape.CreateShapeFromWellKnownData("MULTIPOINT(10 20, 30 20,40 20, 10 30, 30 30, 40 30)")));
inMemoryLayer.InternalFeatures.Add("Line", new Feature(BaseShape.CreateShapeFromWellKnownData("LINESTRING(60 60, 70 70,75 60, 80 70, 85 60,95 80)")));
inMemoryLayer.InternalFeatures.Add("Rectangle", new Feature(new RectangleShape(65, 30, 95, 15)));
inMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.FillSolidBrush.Color = GeoColor.FromArgb(100, GeoColor.StandardColors.RoyalBlue);
inMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.OutlinePen.Color = GeoColor.StandardColors.Blue;
inMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle.OuterPen = new GeoPen(GeoColor.FromArgb(200, GeoColor.StandardColors.Red), 5);
inMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle.SymbolPen = new GeoPen(GeoColor.FromArgb(255, GeoColor.StandardColors.Green), 8);
inMemoryLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
mapEngine.StaticLayers.Add("WorldImageLayer", worldImageLayer);
mapEngine.StaticLayers.Add("WorldLayer", worldLayer);
mapEngine.StaticLayers.Add("USStatesLayer", usStatesLayer);
mapEngine.StaticLayers.Add("WorldCapitals", worldCapitalsLayer);
mapEngine.StaticLayers.Add("WorldCapitalsLabels", worldCapitalsLabelsLayer);
mapEngine.StaticLayers.Add("InMemoryLayer", inMemoryLayer);
Any more questions just feel free to let me know.
Thanks.
Yale
Hi Yale!
I tried using Print Preview Dailog, the preview is loaded but the map is not getting printed. Have you encountered this issue?
Thanks/Lino
Lino,
Thanks for your input. I did not encounter this issue before. The print preview and print codes are separate with each other. Both of them are listed above.
It would be nice if you could send me a small sample application if you still have problem.
Any more questions just feel free to let me know.
Thanks.
Yale