jts

Exception indexing polygons with solr (jts not found?)

£可爱£侵袭症+ 提交于 2019-12-23 22:07:43
问题 I'm having trouble setting up solr 4.10.2 to work with polygons. I try to adapt the example application to work with an field called geom with the type location_rpt . I added jts-1.13.jar to the file solr-4.10.2/example/webapps/solr.war in the directory WEB-INF/lib and I created a field in schema.xml: <field name="geom" type="location_rpt" indexed="true" stored="true" /> I start solr with java -jar start.jar . But when I try to add a document with a geom field I get an exception: Caused by:

Java how to draw and fill a Polygon which has holes

天大地大妈咪最大 提交于 2019-12-23 12:16:11
问题 I am currently trying to draw and fill a Polygon which has a hole in it in Java. Normally this would not be a big problem, since I would draw the exterior ring and then draw the interior ring with the color of the background. But the problem is, that the polygon is displayed above a image which should be "seen" through the hole. I am writing the code in Java and am using JTS Topology Suite for my geometry data. This is my current code, which just paints the border and fills the polygon with a

Is there a way to convert a self intersecting polygon to a multipolygon in JTS?

邮差的信 提交于 2019-12-20 08:41:05
问题 Take the invalid polygon POLYGON((0 100, 100 100, 0 0, 100 0, 0 100)) - an egg timer shape with an undeclared point of intersection Many instructions say that JTS can create a valid version of this using the buffer method: Geometry input = new WKTReader().read("POLYGON((0 100, 100 100, 0 0, 100 0, 0 100))"); Geometry output = geom.buffer(0); return output; However, this produces the output POLYGON ((0 100, 100 100, 50 50, 0 100)) where part of the polygon is lost: Is there a way to get JTS to

How to split linestring into parts every x meters with java JTS

折月煮酒 提交于 2019-12-11 20:14:04
问题 I'm trying to use JTS and postgis for backend based on spring. While I know basics of JTS I don't know how to achieve 回答1: Simply use the Java implementation of geographiclib - I believe you want GeodesicLine; then use JTS and postgis to get the linestring coordinates you generate that way into postgresql. This geodesic path example in JavaScript should get you started. 回答2: I wrote the following method that is capable of what you are asking for and uses JTS LineSegment objects to calculate

Geotools: bounding box for a buffer in wgs84

社会主义新天地 提交于 2019-12-07 15:41:20
问题 I am need a Java function that will generate a bounding box (rectangle) around a buffer. The buffer is defined by the center point (WGS84 coordinate) and the radius (in meters). Getting a bounding box for a buffer in JTS seems to be quite simple: Point center = .... Geometry boundingBox = center.buffer(...).getEnvelope(); This however is pure planar geometry. Is there a way to do this using a coordinate reference system with the distance given in meters? Optimally with Geotools but other Java

Geotools: bounding box for a buffer in wgs84

旧街凉风 提交于 2019-12-06 02:14:21
I am need a Java function that will generate a bounding box (rectangle) around a buffer. The buffer is defined by the center point (WGS84 coordinate) and the radius (in meters). Getting a bounding box for a buffer in JTS seems to be quite simple: Point center = .... Geometry boundingBox = center.buffer(...).getEnvelope(); This however is pure planar geometry. Is there a way to do this using a coordinate reference system with the distance given in meters? Optimally with Geotools but other Java solutions will also work... Although you have approached it in another way, I have another solution

Geometry from vividsolutions JTS fails when creating JSON

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-05 17:42:54
问题 pals. I'm using vividsolutions's library JTS (1.13) for Points and Polygons in my application, but when I try to convert geometry objects into JSON, my application fails. There is my source: @RequestMapping(value = "/test_point", method = RequestMethod.GET, produces = "application/json;charset=UTF-8") @ResponseBody public Map<String, Object> testPoint() { Point point = geometryFactory.createPoint(new Coordinate(37.73, 60.45)); return RequestMapBuilder.getInstance() .addAttribute("point",

Calculate if an object is inside a set of coordinates?

。_饼干妹妹 提交于 2019-12-03 11:06:36
问题 I have a set of X and Y points that builds a shape and I need to know if an object is inside it or not what is the calculation to it ? X and Y coords example: 522.56055 2389.885 544.96 2386.3406 554.18616 2369.2385 535.21814 2351.396 497.5552 2355.8396 I am not really good with math :( so i would appreciate some support to understand how it is done. Example of what I have so far but doesnt seem very reliable: private boolean isInsideShape(Zone verifyZone, Position object) { int corners =

Is there a way to convert a self intersecting polygon to a multipolygon in JTS?

*爱你&永不变心* 提交于 2019-12-02 17:10:58
Take the invalid polygon POLYGON((0 100, 100 100, 0 0, 100 0, 0 100)) - an egg timer shape with an undeclared point of intersection Many instructions say that JTS can create a valid version of this using the buffer method: Geometry input = new WKTReader().read("POLYGON((0 100, 100 100, 0 0, 100 0, 0 100))"); Geometry output = geom.buffer(0); return output; However, this produces the output POLYGON ((0 100, 100 100, 50 50, 0 100)) where part of the polygon is lost: Is there a way to get JTS to validate polygons such that it will produce the output MULTIPOLYGON(((0 100, 100 100, 50 50, 0 100)),

分布式事务系列(2.1)分布式事务的概念

时光怂恿深爱的人放手 提交于 2019-11-28 11:04:10
#1 系列目录 分布式事务系列(开篇)提出疑问和研究过程 分布式事务系列(1.1)Spring事务管理器PlatformTransactionManager源码分析 分布式事务系列(1.2)Spring事务体系 分布式事务系列(2.1)分布式事务模型与接口定义 分布式事务系列(3.1)jotm的分布式案例 分布式事务系列(3.2)jotm分布式事务源码分析 分布式事务系列(4.1)Atomikos的分布式案例 #2 X/Open DTP DTP全称是Distributed Transaction Process,即分布式事务模型。之前我们接触的事务都是针对单个数据库的操作,如果涉及多个数据库的操作,还想保证原子性,这就需要使用分布式事务了。而X/Open DTP就是一种分布式事务处理模型。 ##2.1 X/Open DTP模型 X/Open是一个组织,维基百科上这样说明: X/Open是1984年由多个公司联合创建的一个用于定义和推进信息技术领域开放标准的公司 上述组织就针对分布式事务提出了一个模型,即DTP模型(Distributed Transaction Process),该模型如下所示: 上面主要涉及了三个对象: AP(Application Program):应用程序 TM(Transaction Manager):事务管理器 负责协调和管理事务