-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Buffer a LineString and get a Polygon #198
Comments
Apologies. The following code snippet does what I want although I had to use the JtsSpatialContext.
|
Hi. Spatial4j provides an extended syntax on WKT for this. In WktShapeParserTest.testLineStringShape,
As it happens, the assertion failed which puzzled me for a bit so I dug deeper. It's because the constructor for BufferedLineString internally has a boolean parameter
|
Oh I didn't fully answer your question; I was caught up in the syntax. Since you want rounded corners and a polygon -- you'll need to use JtsSpatialContext and not the default implementation which is rectangular. The default implementation is fairly simple and fast -- it may be appropriate for some use-cases. The Spatial4j wrapper around JTS doesn't allow customizing the particulars of the buffering, but you could subclass JtsShapeFactory (a Spatial4j thing) to override |
you'll need to use JtsSpatialContext and not the default implementation which is rectangular. The default implementation is fairly simple and fast -- it may be appropriate for some use-cases. The Spatial4j wrapper around JTS doesn't allow customizing the particulars of the buffering, but you could subclass JtsShapeFactory (a Spatial4j thing) to override lineString(...) to do something special if you wanted. |
Is it possible to replicate the following with this library?
SELECT ST_AsText(ST_Buffer( ST_GeomFromText( 'LINESTRING(-105.279057455338 40.0157700624913,-105.279021664612 40.0158066914082,-105.278825611896 40.0158601679504,-105.278177942238 40.0159837172032,-105.278111222289 40.0159908418209,-105.277966634459 40.0158862356693,-105.277770665563 40.0153484527617,-105.277472353629 40.0144385971722,-105.277516023345 40.0144085899588,-105.277577546514 40.0144604739395,-105.277956073261 40.0147031300363,-105.278068055488 40.0147474703041,-105.27818380957 40.0148268469272,-105.278272909201 40.0148850173352,-105.278353710748 40.0149219815282,-105.278412719346 40.0149662379769,-105.278506848119 40.0151822396217,-105.278514056555 40.0152136717586,-105.278559067375 40.0152571738361,-105.278624949134 40.0152834930121,-105.278688735418 40.0152967364191,-105.278781606905 40.0153124943971,-105.278852014891 40.0153315213173,-105.279010349042 40.0155112293213,-105.279043876655 40.0156956311911)' , 4326), 0.00006, 'endcap=round join=round quad_segs=32'));
The text was updated successfully, but these errors were encountered: