Quantcast

creating buffer inside a polygon

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

creating buffer inside a polygon

Yared Abayneh
Hi Eric,

If there are point features located in a polygon feature, how can I check that any of these points are within a distance of (lets say 50m) the polygon geometry?
 
Cheers,
Yared
-----------------------------------------------------------------
Yared Abayneh Abebe, MSc
PhD Research Fellow in Urban Water Systems
Environmental Engineering and Water Technology Department
UNESCO-IHE Institute for Water Education
Westvest 7 - P.O.Box 3015
2601 DA Delft, The Netherlands


------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Repast-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/repast-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: creating buffer inside a polygon

Tatara, Eric R.
Yared,

There are few approaches to this.  I would first try to perform an intersection query on the points and the polygon to get the points that are inside the polygon.  Next you can check the distance of the points to the polygon border using the JTS DistanceOP.closestPoints() which will return a pair of points - one will be the original point, and the other will be the closest point on the polygon:

http://www.vividsolutions.com/jts/javadoc/com/vividsolutions/jts/operation/distance/DistanceOp.html

Then use JTS.orthodromicDistance(...) to calculate the linear distance between the pair of points:

http://docs.geotools.org/latest/javadocs/org/geotools/geometry/jts/JTS.html

Note that the DistanceOP also has a distance() method, however this will return the distance in degrees and not in units of the CRS, which is probably what you want to use.

The second approach is to create a negative buffer inside the original polygon using JTS BufferOP with a negative distance:

http://www.vividsolutions.com/jts/javadoc/com/vividsolutions/jts/operation/buffer/BufferOp.html

This will create an internal polygon inside the original (will not modify original).  The actual buffer region would be the difference between the two polygons.  If the polygon shape is not moving or changing size, I would create and store the difference polygon using JTS Geometry.difference()  and then simply check which points intersect with the difference polygon.  Note that Geometry class also has a buffer method for creating buffers, but I don't believe it allows negative distance so you will need to use the BufferOp class.

eric

Eric Tatara, PhD, PE
Software Engineer
Global Security Sciences Division
Argonne National Laboratory

From: [hidden email] [[hidden email]]
Sent: Friday, April 29, 2016 11:35 AM
To: Tatara, Eric R.; Repast List
Subject: creating buffer inside a polygon

Hi Eric,

If there are point features located in a polygon feature, how can I check that any of these points are within a distance of (lets say 50m) the polygon geometry?
 
Cheers,
Yared
-----------------------------------------------------------------
Yared Abayneh Abebe, MSc
PhD Research Fellow in Urban Water Systems
Environmental Engineering and Water Technology Department
UNESCO-IHE Institute for Water Education
Westvest 7 - P.O.Box 3015
2601 DA Delft, The Netherlands


------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Repast-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/repast-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: creating buffer inside a polygon

Yared Abayneh
Eric,

Thank you for the reply.

I have recommendations for future users of the mentioned methods. I tested the distance between two geometries (couple of points and a polygon) and compared the results from JTS.orthodromicDistance(...) and distance() methods with ground distance (or map distance) of the geometries in Google Earth. What I observed is that the distance() method gives much closer result to the Google Earth distance than the result of JTS.orthodromicDistance(...). If one wants the result in SI unit, the only additional level of calculation in using distance() method is the resulting decimal degree needs to be converted to metric unit.

The drawback with creating negative buffers is that it may create error if the buffer overlaps. For example, in the Geography model, trying to create -1km buffer results in error.

In unrelated topic, I have a comment about GIS (2D) display. In Repast Simphony 2.3.1, it is not possible to change the agent style in the Options Editor of the run time environment. I hope this issue will be solved in the next release. I managed to change the style by changing the display.xml file but it was very cumbersome. By the way, is it possible to change the style using display classes (similar to the 3D SurfaceShapeStyle)? 
 
Cheers,

Yared
-----------------------------------------------------------------
Yared Abayneh Abebe, MSc
PhD Research Fellow in Urban Water Systems
Environmental Engineering and Water Technology Department
UNESCO-IHE Institute for Water Education
Westvest 7 - P.O.Box 3015
2601 DA Delft, The Netherlands



On Wednesday, May 4, 2016 6:18 PM, "Tatara, Eric R." <[hidden email]> wrote:


Yared,

There are few approaches to this.  I would first try to perform an intersection query on the points and the polygon to get the points that are inside the polygon.  Next you can check the distance of the points to the polygon border using the JTS DistanceOP.closestPoints() which will return a pair of points - one will be the original point, and the other will be the closest point on the polygon:

http://www.vividsolutions.com/jts/javadoc/com/vividsolutions/jts/operation/distance/DistanceOp.html

Then use JTS.orthodromicDistance(...) to calculate the linear distance between the pair of points:

http://docs.geotools.org/latest/javadocs/org/geotools/geometry/jts/JTS.html

Note that the DistanceOP also has a distance() method, however this will return the distance in degrees and not in units of the CRS, which is probably what you want to use.

The second approach is to create a negative buffer inside the original polygon using JTS BufferOP with a negative distance:

http://www.vividsolutions.com/jts/javadoc/com/vividsolutions/jts/operation/buffer/BufferOp.html

This will create an internal polygon inside the original (will not modify original).  The actual buffer region would be the difference between the two polygons.  If the polygon shape is not moving or changing size, I would create and store the difference polygon using JTS Geometry.difference()  and then simply check which points intersect with the difference polygon.  Note that Geometry class also has a buffer method for creating buffers, but I don't believe it allows negative distance so you will need to use the BufferOp class.

eric

Eric Tatara, PhD, PE
Software Engineer
Global Security Sciences Division
Argonne National Laboratory

From: [hidden email] [[hidden email]]
Sent: Friday, April 29, 2016 11:35 AM
To: Tatara, Eric R.; Repast List
Subject: creating buffer inside a polygon

Hi Eric,

If there are point features located in a polygon feature, how can I check that any of these points are within a distance of (lets say 50m) the polygon geometry?
 
Cheers,
Yared
-----------------------------------------------------------------
Yared Abayneh Abebe, MSc
PhD Research Fellow in Urban Water Systems
Environmental Engineering and Water Technology Department
UNESCO-IHE Institute for Water Education
Westvest 7 - P.O.Box 3015
2601 DA Delft, The Netherlands




------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
_______________________________________________
Repast-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/repast-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: creating buffer inside a polygon

Tatara, Eric R.
Thanks for your feedback regarding the distance methods and the agent display issue.  The agent style editor will be fixed in the next release and for now it's the only way to style agents in the 2D GIS display.   This display is actually based on the legacy GeoTools map renderer and it requires an SLD-based styler rather than the style class-based approaches of the other displays.


Eric Tatara, PhD, PE
Software Engineer
Global Security Sciences Division
Argonne National Laboratory

From: [hidden email] [[hidden email]]
Sent: Tuesday, May 10, 2016 8:16 AM
To: Tatara, Eric R.; Repast List
Subject: Re: creating buffer inside a polygon

Eric,

Thank you for the reply.

I have recommendations for future users of the mentioned methods. I tested the distance between two geometries (couple of points and a polygon) and compared the results from JTS.orthodromicDistance(...) and distance() methods with ground distance (or map distance) of the geometries in Google Earth. What I observed is that the distance() method gives much closer result to the Google Earth distance than the result of JTS.orthodromicDistance(...). If one wants the result in SI unit, the only additional level of calculation in using distance() method is the resulting decimal degree needs to be converted to metric unit.

The drawback with creating negative buffers is that it may create error if the buffer overlaps. For example, in the Geography model, trying to create -1km buffer results in error.

In unrelated topic, I have a comment about GIS (2D) display. In Repast Simphony 2.3.1, it is not possible to change the agent style in the Options Editor of the run time environment. I hope this issue will be solved in the next release. I managed to change the style by changing the display.xml file but it was very cumbersome. By the way, is it possible to change the style using display classes (similar to the 3D SurfaceShapeStyle)? 
 
Cheers,

Yared
-----------------------------------------------------------------
Yared Abayneh Abebe, MSc
PhD Research Fellow in Urban Water Systems
Environmental Engineering and Water Technology Department
UNESCO-IHE Institute for Water Education
Westvest 7 - P.O.Box 3015
2601 DA Delft, The Netherlands



On Wednesday, May 4, 2016 6:18 PM, "Tatara, Eric R." <[hidden email]> wrote:


Yared,

There are few approaches to this.  I would first try to perform an intersection query on the points and the polygon to get the points that are inside the polygon.  Next you can check the distance of the points to the polygon border using the JTS DistanceOP.closestPoints() which will return a pair of points - one will be the original point, and the other will be the closest point on the polygon:

http://www.vividsolutions.com/jts/javadoc/com/vividsolutions/jts/operation/distance/DistanceOp.html

Then use JTS.orthodromicDistance(...) to calculate the linear distance between the pair of points:

http://docs.geotools.org/latest/javadocs/org/geotools/geometry/jts/JTS.html

Note that the DistanceOP also has a distance() method, however this will return the distance in degrees and not in units of the CRS, which is probably what you want to use.

The second approach is to create a negative buffer inside the original polygon using JTS BufferOP with a negative distance:

http://www.vividsolutions.com/jts/javadoc/com/vividsolutions/jts/operation/buffer/BufferOp.html

This will create an internal polygon inside the original (will not modify original).  The actual buffer region would be the difference between the two polygons.  If the polygon shape is not moving or changing size, I would create and store the difference polygon using JTS Geometry.difference()  and then simply check which points intersect with the difference polygon.  Note that Geometry class also has a buffer method for creating buffers, but I don't believe it allows negative distance so you will need to use the BufferOp class.

eric

Eric Tatara, PhD, PE
Software Engineer
Global Security Sciences Division
Argonne National Laboratory

From: [hidden email] [[hidden email]]
Sent: Friday, April 29, 2016 11:35 AM
To: Tatara, Eric R.; Repast List
Subject: creating buffer inside a polygon

Hi Eric,

If there are point features located in a polygon feature, how can I check that any of these points are within a distance of (lets say 50m) the polygon geometry?
 
Cheers,
Yared
-----------------------------------------------------------------
Yared Abayneh Abebe, MSc
PhD Research Fellow in Urban Water Systems
Environmental Engineering and Water Technology Department
UNESCO-IHE Institute for Water Education
Westvest 7 - P.O.Box 3015
2601 DA Delft, The Netherlands




------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
_______________________________________________
Repast-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/repast-interest
Loading...