Fixing bad geometry on downloaded features

183 views
Skip to first unread message

Pete - Marin County Parks

unread,
Sep 23, 2015, 12:31:56 PM9/23/15
to Weed Manager
Just wanted to document a problem I had and how I solved it.

I was trying to do some analysis of data downloaded from calflora and was getting weird results. I realized some features were being left out and eventually ran a test using Check Geometry in ArcGIS. This showed a problem of "self intersections" on most of the polygons I had noticed problems on.

By running Repair Geometry (again from the ArcGIS toolbox) I was able to fix the data.

This problem seemed to be present in both shapefiles and GeoJSON, and I did not find a convenient fix for this in QGIS.

Michael Norelli

unread,
Sep 23, 2015, 1:46:45 PM9/23/15
to Pete - Marin County Parks, Weed Manager

Thanks, Pete.

 

This is a common problem when GPSing polygons, but yes, that’s the best fix (besides checking your GPS data in Pathfinder Office (if you are using Trimble gear) before exporting to shapefiles).

 

** It would be great if this kind of data cleanup could be built in on the CalFlora server side, so even if people upload problem data, future exports will be clean.

 

As for QGIS solutions, checking these:

http://gis.stackexchange.com/questions/112687/how-to-fix-quickly-a-lot-of-geometry-validity-errors-in-qgis

http://gis.stackexchange.com/questions/33995/how-to-repair-topology-of-a-shapefile

 

seems to offer solutions including:

-          adding lwgeom plugin, then adding lwgeom provider to the processing toolbox to run ST_MakeValid tool https://plugins.qgis.org/plugins/processinglwgeomprovider/

-          import to GRASS and use v.clean tool in the Processing Toolbox

 

Michael Norelli
GIS Manager, Golden Gate National Parks Conservancy
35S Fort Mason, San Francisco, CA 94123 • (415) 561-3091 • cell (415) 625-3360

 

http://www.parksconservancy.org/
P A R K S  F O R  A L L  F O R E V E R 

--
You received this message because you are subscribed to the Google Groups "Weed Manager" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weed-manager-cal...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Cynthia Powell

unread,
Sep 23, 2015, 1:52:55 PM9/23/15
to Pete - Marin County Parks, Weed Manager

Hi Pete and WM folks,

When you walk a polygon using Observer Pro, depending on your satellite fix, you could end up with a self-intersecting polygon (zoom in to see south corner):
http://www.calflora.org/entry/poe.html#vrid=mg10199

If this happens, you can edit the shape at the time using Observer Pro (touch and hold the point, then move it), or later using Plant Observation Entry.
Have others encountered this situation, and if so, how did you proceed and how could Calflora help?

Cynthia & John

 

From: weed-manag...@googlegroups.com [mailto:weed-manag...@googlegroups.com] On Behalf Of Pete - Marin County Parks
Sent: Wednesday, September 23, 2015 9:32 AM
To: Weed Manager
Subject: Fixing bad geometry on downloaded features

 

Just wanted to document a problem I had and how I solved it.

--

John Malpas

unread,
Sep 23, 2015, 7:36:26 PM9/23/15
to Weed Manager
I just looked closely at the problem polygons, and here is what I think
is happening. The person entering is walking back to the first point,
and pressing APPEND POINT one extra time, which makes a little waffle
between the first and last points.

In Observer Pro, when you are drawing a polygon by walking the perimiter,
the app shows the polygon in light red as soon as there are three points.
The last point is connected to the first point, so it is not necessary to go
back to the origin in order to close the polygon.

If you do put a final point close to where the first point is, you run the
risk of making the polygon self-intersecting, which is what Pete noticed.
(BTW self-intersecting polygons seem to display just fine through tthe
Google Maps API. We have not yet done enough tests to figure out what
impact a self-intersection has on the area calculation, but at least the
area calculation does not crash.)



Wakamiya, Sarah

unread,
Sep 24, 2015, 12:27:00 PM9/24/15
to John Malpas, Pete - Marin County Parks, Weed Manager
Pete - thanks for noticing this issue.  This slipped past our radar.  

John and Cynthia - I ran the check geometry function on our data and it looks like we have over 200 records with self-intersecting issues.  About 40 of these were created in Weed Manager, the remainder were created in our legacy database.  John provided insight in how to avoid creating these in the future and we'll be sure to adhere to his advice.  

I am wondering, as Michael Norelli pointed out, if there is a way to correct these bad geometry issues in Weed Manager in batch so that future downloads will not have the same problem.  If possible, we'd like to avoid going to each of these 200 records to fix them manually...

------------------------------------------------
Sarah Wakamiya
Data Manager/Ecologist
San Francisco Bay Area Network
National Park Service
Fort Cronkhite, Bldg. 1063
Sausalito, CA  94965
415-464-5173 (Typically M-W)
415-289-1853 (Typically Th)

Cynthia Powell

unread,
Sep 25, 2015, 11:44:27 AM9/25/15
to Wakamiya, Sarah, John Malpas, Pete - Marin County Parks, Weed Manager

Sounds like what is on the table is two features:

1. one to identify polygons with a self-intersection between the first and last vertex (where the last vertex is very close to the first vertex), and

2. another feature to auto-correct these polygons by omitting the last vertex. Let's put some funding together to make this happen.

Pete - Marin County Parks

unread,
Oct 1, 2015, 11:22:05 AM10/1/15
to Weed Manager
Someone on my staff pointed out that the app will indicate to you whether your polygon has any intersection problems in it. A valid polygon will fill in with translucent red, whereas a invalid polygon has no fill.

Pete

To unsubscribe from this group and stop receiving emails from it, send an email to weed-manager-calflora+unsub...@googlegroups.com.


For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Weed Manager" group.

To unsubscribe from this group and stop receiving emails from it, send an email to weed-manager-calflora+unsub...@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages