1

I have a Java GUI Swing application with three frames. I want to load a map from a shapefile and draw the map on an existing application frame. For this I use GeoTools framework. I've looked at the examples and all examples have drawn the map on a separate GUI window JMapFrame.

(I've followed this link http://docs.geotools.org/latest/userguide/tutorial/quickstart/netbeans.html)

Is there a way which we can embed a map that we have created using Geotools to an existing Java Swing application?

1 Answer 1

0

You would use a JMapPane - for the most part I would look at the code for JMapFrame and cherry pick the parts I needed in my application.

2
  • Thanks. I'm currently working on what you suggested. In the mean time, my end application would need features like adding new lines, nodes to the map, selecting a line/node on the map and displaying properties of that selected part and drawing names/values on the map. (Eg: population of a city). I'm curious whether JMapPane is the answer for this as the document says JMapPane is just for demo purpose, but not intended for Desktop GIS apps. Please comment on this.
    – tybandara
    Apr 5, 2016 at 13:24
  • JMapPane just draws maps, it's up to you to add other UI widgets etc to provide the functions you need.
    – Ian Turton
    Apr 5, 2016 at 17:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.