ArduPilot / MissionPlanner

Mission Planner Ground Control Station for ArduPilot (c# .net)
http://ardupilot.org/planner/
GNU General Public License v3.0
1.69k stars 2.33k forks source link

Load Poly from SHP file. #594

Open tristannovak opened 9 years ago

tristannovak commented 9 years ago

Just finished this enhancement, would like a few people to try it that have some SHP files of closed boundaries.

Combined two previous tools: Shp to Poly + Load Polygon.

http://youtu.be/rVM9xj8m070

fromshp

iskess commented 9 years ago

I don't see this in the latest beta so I can't test, but it looks great!!

tristannovak commented 9 years ago

It's in release 1.3.8

airborneimager commented 9 years ago

Tristan - thanks for this addition, but I'm afraid you've still got some work to do. I tried this on two shp files I have - it worked perfectly on one, and failed on the other (with a large error dialog box). I know the difference between the two was that the one that worked was a simply rectangular region, whereas the other was a set of several such polygons contained in a single .shp file. I didn't know a shape file could contain multiple polygons, but apparently it can. In order to be robust, your code should check that (a) the shp file is actually a shp file (not something else renamed to *.shp), and (b) if your code expects a single polygon, that it tests and rejects a .shp file that contains more than one polygon, or just reads the first polygon, or something else logical.

tristannovak commented 9 years ago

I assumed it would error with multiple polygon shp. I just didn't have one handy to test with. The user will just have to make sure the shp is correct for now. I will try and get to it asap.

I was hoping to get some feedback on how users would like the multi poly shp handled. When i finished it at 3am this morning, I was just happy to have it ready to show at a conference today. :)

ReMapHI commented 9 years ago

It's really great to see more support for shapefiles, but those pin markers are not ideal. They are the same size and shape as the pin markers for the waypoints. It's too cluttered! Could the polygon nodes be represented as dots instead? BTW, to reduce display clutter, I also think that the waypoint pin markers could be omitted. The numbered callouts would be sufficient.

image

ReMapHI commented 9 years ago

I had another question/request:

Could you add support for KML/KMZ?

tristannovak commented 9 years ago

@airborneimager

Here is a start to a solution.

https://www.youtube.com/watch?v=Mr6RK_UlaBU

tristannovak commented 9 years ago

multi

airborneimager commented 9 years ago

@tristannovak:

This is progress, but I have a couple of questions/comments:

(1) It isn't clear what you mean by "Would you like to use the current polygon?". If the user answers "No", does that mean to 'cancel the creation of the currently displayed shape as a polygon object in Mission Planner', or does it mean 'skip to the next polygon found in the shape file'?

(1) I don't think dialog text should use the second person, conversational style - I think it should read "This shape file contains multiple polygons - accept currently displayed polygon?".

If you are able to pull all of the polygons out of the shape file, would the user be able to browse through them to find the one he/she wants?

tristannovak commented 9 years ago

The video shows the behavior and answers to all three questions. That said I will also answer them.

(1) [No] clears the current poly and generates the next.

I was working on displaying [Use] [Prev] [Next] [Cancel] buttons, obviously [Prev] and [Next] would be hidden on first and last image respectfully. The problem is: MessageBoxButtons Enumerator is limited to [Abort][Retry][Ignore][Ok][Yes][No][Cancel] in pre-specified orders. I will have to write a new Enumerator and Class for the custom choices....

See: http://msdn.microsoft.com/en-us/library/system.windows.forms.messageboxbuttons%28v=vs.110%29.aspx

(2) Agreed that the text can and should be different, I put about a second of thought into the wording as I was very frustrated with the other limitations I was facing.

(3) Yes it loops through all of the poly's in the shape file.

Even after the above issues are resolved I will not be happy with the handling of multiple poly's.

This is what I am working on: If the shape file contains multiple poly's they would be displayed in a new window. The user would then choose the poly he would like to use. That poly is then loaded to the FlightPlanner screen.

For robust code this will take some time. Due to the complexities of shape files, the different ways programs generate them, and other things out of my control. In the mean time. I can add the first solution, to a pull request, if it would be useful for someone. For now, for my needs, I am fine with making sure the shape file only contains one poly.

See: http://support.esri.com/en/knowledgebase/whitepapers/view/productid/21/metaid/279

ddomit commented 7 years ago

Hi all!

I'm just finding this feature and I think its amazing and incredibly usefull!

I just tried to import a multiple polygon shapefile and it starts creating the polygon, bue after abour 5 seconds it gets stuck and i have to quit the program. Any ideas?

There are maany polygons in there!

andreas-eberle commented 6 years ago

Is there a chance to get in the support for multiple polygons in a shapefile?