当前位置: 首页>>代码示例>>Java>>正文


Java JtsSpatialContext.GEO属性代码示例

本文整理汇总了Java中com.spatial4j.core.context.jts.JtsSpatialContext.GEO属性的典型用法代码示例。如果您正苦于以下问题:Java JtsSpatialContext.GEO属性的具体用法?Java JtsSpatialContext.GEO怎么用?Java JtsSpatialContext.GEO使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.spatial4j.core.context.jts.JtsSpatialContext的用法示例。


在下文中一共展示了JtsSpatialContext.GEO属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: geoSpeedTest

@Test
public void geoSpeedTest() throws IOException, ParseException {

  RecursivePrefixTreeStrategy strategy = new RecursivePrefixTreeStrategy(new GeohashPrefixTree(JtsSpatialContext.GEO, 11),
      "location");

  IndexWriterConfig conf = new IndexWriterConfig(new StandardAnalyzer());
  final RAMDirectory directory = new RAMDirectory();
  final IndexWriter writer = new IndexWriter(directory, conf);

  Shape multiPolygon = JtsSpatialContext.GEO
      .getWktShapeParser()
      .parse(
          "MULTIPOLYGON (((15.520376 38.231155, 15.160243 37.444046, 15.309898 37.134219, 15.099988 36.619987, 14.335229 36.996631, 13.826733 37.104531, 12.431004 37.61295, 12.570944 38.126381, 13.741156 38.034966, 14.761249 38.143874, 15.520376 38.231155)), ((9.210012 41.209991, 9.809975 40.500009, 9.669519 39.177376, 9.214818 39.240473, 8.806936 38.906618, 8.428302 39.171847, 8.388253 40.378311, 8.159998 40.950007, 8.709991 40.899984, 9.210012 41.209991)), ((12.376485 46.767559, 13.806475 46.509306, 13.69811 46.016778, 13.93763 45.591016, 13.141606 45.736692, 12.328581 45.381778, 12.383875 44.885374, 12.261453 44.600482, 12.589237 44.091366, 13.526906 43.587727, 14.029821 42.761008, 15.14257 41.95514, 15.926191 41.961315, 16.169897 41.740295, 15.889346 41.541082, 16.785002 41.179606, 17.519169 40.877143, 18.376687 40.355625, 18.480247 40.168866, 18.293385 39.810774, 17.73838 40.277671, 16.869596 40.442235, 16.448743 39.795401, 17.17149 39.4247, 17.052841 38.902871, 16.635088 38.843572, 16.100961 37.985899, 15.684087 37.908849, 15.687963 38.214593, 15.891981 38.750942, 16.109332 38.964547, 15.718814 39.544072, 15.413613 40.048357, 14.998496 40.172949, 14.703268 40.60455, 14.060672 40.786348, 13.627985 41.188287, 12.888082 41.25309, 12.106683 41.704535, 11.191906 42.355425, 10.511948 42.931463, 10.200029 43.920007, 9.702488 44.036279, 8.888946 44.366336, 8.428561 44.231228, 7.850767 43.767148, 7.435185 43.693845, 7.549596 44.127901, 7.007562 44.254767, 6.749955 45.028518, 7.096652 45.333099, 6.802355 45.70858, 6.843593 45.991147, 7.273851 45.776948, 7.755992 45.82449, 8.31663 46.163642, 8.489952 46.005151, 8.966306 46.036932, 9.182882 46.440215, 9.922837 46.314899, 10.363378 46.483571, 10.442701 46.893546, 11.048556 46.751359, 11.164828 46.941579, 12.153088 47.115393, 12.376485 46.767559)))");

  Document doc = new Document();

  for (IndexableField f : strategy.createIndexableFields(multiPolygon)) {
    doc.add(f);
  }

  writer.addDocument(doc);
  writer.commit();

  writer.close();
}
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:26,代码来源:LuceneGeoTest.java

示例2: PointInPolygonHelper

public PointInPolygonHelper() throws ParseException {
	ctx = JtsSpatialContext.GEO;
	geometries = new HashMap<String, Shape>();

	String newYork = "Polygon((-73.343806 45.013027, -73.332852 44.804903, -73.387622 44.618687, -73.294514 44.437948, -73.321898 44.246255, -73.436914 44.043608, -73.349283 43.769761, -73.404052 43.687607, -73.245221 43.523299, -73.278083 42.833204, -73.267129 42.745573, -73.508114 42.08834, -73.486206 42.050002, -73.55193 41.294184, -73.48073 41.21203, -73.727192 41.102491, -73.655992 40.987475, -73.22879 40.905321, -73.141159 40.965568, -72.774204 40.965568, -72.587988 40.998429, -72.28128 41.157261, -72.259372 41.042245, -72.100541 40.992952, -72.467496 40.845075, -73.239744 40.625997, -73.562884 40.582182, -73.776484 40.593136, -73.935316 40.543843, -74.022947 40.708151, -73.902454 40.998429, -74.236547 41.14083, -74.69661 41.359907, -74.740426 41.431108, -74.89378 41.436584, -75.074519 41.60637, -75.052611 41.754247, -75.173104 41.869263, -75.249781 41.863786, -75.35932 42.000709, -79.76278 42.000709, -79.76278 42.252649, -79.76278 42.269079, -79.149363 42.55388, -79.050778 42.690804, -78.853608 42.783912, -78.930285 42.953697, -79.012439 42.986559, -79.072686 43.260406, -78.486653 43.375421, -77.966344 43.369944, -77.75822 43.34256, -77.533665 43.233021, -77.391265 43.276836, -76.958587 43.271359, -76.695693 43.34256, -76.41637 43.523299, -76.235631 43.528776, -76.230154 43.802623, -76.137046 43.961454, -76.3616 44.070993, -76.312308 44.196962, -75.912491 44.366748, -75.764614 44.514625, -75.282643 44.848718, -74.828057 45.018503, -74.148916 44.991119, -73.343806 45.013027))";
	String newJersey = "Polygon((-74.236547 41.14083, -73.902454 40.998429, -74.022947 40.708151, -74.187255 40.642428, -74.274886 40.489074, -74.001039 40.412397, -73.979131 40.297381, -74.099624 39.760641, -74.411809 39.360824, -74.614456 39.245808, -74.795195 38.993869, -74.888303 39.158177, -75.178581 39.240331, -75.534582 39.459409, -75.55649 39.607286, -75.561967 39.629194, -75.507197 39.683964, -75.414089 39.804456, -75.145719 39.88661, -75.129289 39.963288, -74.82258 40.127596, -74.773287 40.215227, -75.058088 40.417874, -75.069042 40.543843, -75.195012 40.576705, -75.205966 40.691721, -75.052611 40.866983, -75.134765 40.971045, -74.882826 41.179168, -74.828057 41.288707, -74.69661 41.359907, -74.236547 41.14083))";
	String connecticut = "Polygon((-73.053528 42.039048, -71.799309 42.022617, -71.799309 42.006186, -71.799309 41.414677, -71.859555 41.321569, -71.947186 41.338, -72.385341 41.261322, -72.905651 41.28323, -73.130205 41.146307, -73.371191 41.102491, -73.655992 40.987475, -73.727192 41.102491, -73.48073 41.21203, -73.55193 41.294184, -73.486206 42.050002, -73.053528 42.039048))";
	String delaware = "Polygon((-75.414089 39.804456, -75.507197 39.683964, -75.611259 39.61824, -75.589352 39.459409, -75.441474 39.311532, -75.403136 39.065069, -75.189535 38.807653, -75.09095 38.796699, -75.047134 38.451652, -75.693413 38.462606, -75.786521 39.722302, -75.616736 39.831841, -75.414089 39.804456))";
	String pennsylvania = "Polygon((-79.76278 42.252649, -79.76278 42.000709, -75.35932 42.000709, -75.249781 41.863786, -75.173104 41.869263, -75.052611 41.754247, -75.074519 41.60637, -74.89378 41.436584, -74.740426 41.431108, -74.69661 41.359907, -74.828057 41.288707, -74.882826 41.179168, -75.134765 40.971045, -75.052611 40.866983, -75.205966 40.691721, -75.195012 40.576705, -75.069042 40.543843, -75.058088 40.417874, -74.773287 40.215227, -74.82258 40.127596, -75.129289 39.963288, -75.145719 39.88661, -75.414089 39.804456, -75.616736 39.831841, -75.786521 39.722302, -79.477979 39.722302, -80.518598 39.722302, -80.518598 40.636951, -80.518598 41.978802, -80.518598 41.978802, -80.332382 42.033571, -79.76278 42.269079, -79.76278 42.252649))";
	String massachusetts = "Polygon((-70.917521 42.887974, -70.818936 42.871543, -70.780598 42.696281, -70.824413 42.55388, -70.983245 42.422434, -70.988722 42.269079, -70.769644 42.247172, -70.638197 42.08834, -70.660105 41.962371, -70.550566 41.929509, -70.539613 41.814493, -70.260289 41.715908, -69.937149 41.809016, -70.008349 41.672093, -70.484843 41.5516, -70.660105 41.546123, -70.764167 41.639231, -70.928475 41.611847, -70.933952 41.540646, -71.120168 41.496831, -71.196845 41.67757, -71.22423 41.710431, -71.328292 41.781632, -71.383061 42.01714, -71.530939 42.01714, -71.799309 42.006186, -71.799309 42.022617, -73.053528 42.039048, -73.486206 42.050002, -73.508114 42.08834, -73.267129 42.745573, -72.456542 42.729142, -71.29543 42.696281, -71.185891 42.789389, -70.917521 42.887974))";
	String maryland = "Polygon((-79.477979 39.722302, -75.786521 39.722302, -75.693413 38.462606, -75.047134 38.451652, -75.244304 38.029928, -75.397659 38.013497, -75.671506 37.95325, -75.885106 37.909435, -75.879629 38.073743, -75.961783 38.139466, -75.846768 38.210667, -76.000122 38.374975, -76.049415 38.303775, -76.257538 38.320205, -76.328738 38.500944, -76.263015 38.500944, -76.257538 38.736453, -76.191815 38.829561, -76.279446 39.147223, -76.169907 39.333439, -76.000122 39.366301, -75.972737 39.557994, -76.098707 39.536086, -76.104184 39.437501, -76.367077 39.311532, -76.443754 39.196516, -76.460185 38.906238, -76.55877 38.769315, -76.514954 38.539283, -76.383508 38.380452, -76.399939 38.259959, -76.317785 38.139466, -76.3616 38.057312, -76.591632 38.216144, -76.920248 38.292821, -77.018833 38.446175, -77.205049 38.358544, -77.276249 38.479037, -77.128372 38.632391, -77.040741 38.791222, -76.909294 38.895284, -77.035264 38.993869, -77.117418 38.933623, -77.248864 39.026731, -77.456988 39.076023, -77.456988 39.223901, -77.566527 39.306055, -77.719881 39.322485, -77.834897 39.601809, -78.004682 39.601809, -78.174467 39.694917, -78.267575 39.61824, -78.431884 39.623717, -78.470222 39.514178, -78.765977 39.585379, -78.963147 39.437501, -79.094593 39.470363, -79.291763 39.300578, -79.488933 39.20747, -79.477979 39.722302))";
	String virginia = "Polygon((-78.349729 39.464886, -77.82942 39.130793, -77.719881 39.322485, -77.566527 39.306055, -77.456988 39.223901, -77.456988 39.076023, -77.248864 39.026731, -77.117418 38.933623, -77.040741 38.791222, -77.128372 38.632391, -77.248864 38.588575, -77.325542 38.446175, -77.281726 38.342113, -77.013356 38.374975, -76.964064 38.216144, -76.613539 38.15042, -76.514954 38.024451, -76.235631 37.887527, -76.3616 37.608203, -76.246584 37.389126, -76.383508 37.285064, -76.399939 37.159094, -76.273969 37.082417, -76.410893 36.961924, -76.619016 37.120755, -76.668309 37.065986, -76.48757 36.95097, -75.994645 36.923586, -75.868676 36.551154, -79.510841 36.5402, -80.294043 36.545677, -80.978661 36.562108, -81.679709 36.589492, -83.673316 36.600446, -83.136575 36.742847, -83.070852 36.852385, -82.879159 36.890724, -82.868205 36.978355, -82.720328 37.044078, -82.720328 37.120755, -82.353373 37.268633, -81.969987 37.537003, -81.986418 37.454849, -81.849494 37.285064, -81.679709 37.20291, -81.55374 37.208387, -81.362047 37.339833, -81.225123 37.235771, -80.967707 37.290541, -80.513121 37.482234, -80.474782 37.421987, -80.29952 37.509618, -80.294043 37.690357, -80.184505 37.849189, -79.998289 37.997066, -79.921611 38.177805, -79.724442 38.364021, -79.647764 38.594052, -79.477979 38.457129, -79.313671 38.413313, -79.209609 38.495467, -78.996008 38.851469, -78.870039 38.763838, -78.404499 39.169131, -78.349729 39.464886))";
	String newHampshire = "Polygon((-71.08183 45.303304, -71.032537 44.657025, -70.966814 43.34256, -70.807983 43.227544, -70.824413 43.128959, -70.703921 43.057759, -70.818936 42.871543, -70.917521 42.887974, -71.185891 42.789389, -71.29543 42.696281, -72.456542 42.729142, -72.544173 42.80582, -72.533219 42.953697, -72.445588 43.008466, -72.456542 43.150867, -72.379864 43.572591, -72.204602 43.769761, -72.116971 43.994316, -72.02934 44.07647, -72.034817 44.322932, -71.700724 44.41604, -71.536416 44.585825, -71.629524 44.750133, -71.4926 44.914442, -71.503554 45.013027, -71.361154 45.270443, -71.131122 45.243058, -71.08183 45.303304))";
	String roadIsland = "Polygon((-71.530939 42.01714, -71.383061 42.01714, -71.328292 41.781632, -71.22423 41.710431, -71.344723 41.726862, -71.448785 41.578985, -71.481646 41.370861, -71.859555 41.321569, -71.799309 41.414677, -71.799309 42.006186, -71.530939 42.01714))";
	String maine = "Polygon((-70.703921 43.057759, -70.824413 43.128959, -70.807983 43.227544, -70.966814 43.34256, -71.032537 44.657025, -71.08183 45.303304, -70.649151 45.440228, -70.720352 45.511428, -70.556043 45.664782, -70.386258 45.735983, -70.41912 45.796229, -70.260289 45.889337, -70.309581 46.064599, -70.210996 46.327492, -70.057642 46.415123, -69.997395 46.694447, -69.225147 47.461219, -69.044408 47.428357, -69.033454 47.242141, -68.902007 47.176418, -68.578868 47.285957, -68.376221 47.285957, -68.233821 47.357157, -67.954497 47.198326, -67.790188 47.066879, -67.779235 45.944106, -67.801142 45.675736, -67.456095 45.604536, -67.505388 45.48952, -67.417757 45.379982, -67.488957 45.281397, -67.346556 45.128042, -67.16034 45.160904, -66.979601 44.804903, -67.187725 44.646072, -67.308218 44.706318, -67.406803 44.596779, -67.549203 44.624164, -67.565634 44.531056, -67.75185 44.54201, -68.047605 44.328409, -68.118805 44.476286, -68.222867 44.48724, -68.173574 44.328409, -68.403606 44.251732, -68.458375 44.377701, -68.567914 44.311978, -68.82533 44.311978, -68.830807 44.459856, -68.984161 44.426994, -68.956777 44.322932, -69.099177 44.103854, -69.071793 44.043608, -69.258008 43.923115, -69.444224 43.966931, -69.553763 43.840961, -69.707118 43.82453, -69.833087 43.720469, -69.986442 43.742376, -70.030257 43.851915, -70.254812 43.676653, -70.194565 43.567114, -70.358873 43.528776, -70.369827 43.435668, -70.556043 43.320652, -70.703921 43.057759))";

	addPolygonFromWKT("NY", newYork);
	addPolygonFromWKT("NJ", newJersey);
	addPolygonFromWKT("CT", connecticut);
	addPolygonFromWKT("DE", delaware);
	addPolygonFromWKT("PA", pennsylvania);
	addPolygonFromWKT("MA", massachusetts);
	addPolygonFromWKT("MD", maryland);
	addPolygonFromWKT("VA", virginia);
	addPolygonFromWKT("NH", newHampshire);
	addPolygonFromWKT("RI", roadIsland);
	addPolygonFromWKT("ME", maine);

}
 
开发者ID:InsightEdge,项目名称:geospatial-catastrophe-modeling,代码行数:29,代码来源:PointInPolygonHelper.java

示例3: makeShape

@Override
public Shape makeShape(OCompositeKey key, SpatialContext ctx) {

  SpatialContext ctx1 = JtsSpatialContext.GEO;
  String value = key.getKeys().get(0).toString();

  try {
    return ctx1.getWktShapeParser().parse(value);
  } catch (ParseException e) {
    OLogManager.instance().error(this, "Error on making shape", e);
  }
  return null;
}
 
开发者ID:orientechnologies,项目名称:orientdb-lucene,代码行数:13,代码来源:OPolygonShapeFactory.java

示例4: createSpatialContext

@Override
protected SpatialContext createSpatialContext() {
    return JtsSpatialContext.GEO;
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:4,代码来源:SpatialSupportInitializer.java

示例5: createSpatialAlgebra

@Override
protected SpatialAlgebra createSpatialAlgebra() {
    return new JtsSpatialAlgebra(JtsSpatialContext.GEO);
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:4,代码来源:SpatialSupportInitializer.java

示例6: createWktWriter

@Override
protected WktWriter createWktWriter() {
    return new JtsWktWriter(JtsSpatialContext.GEO);
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:4,代码来源:SpatialSupportInitializer.java

示例7: geoIntersectTest

@Test
public void geoIntersectTest() throws IOException, ParseException {

  RecursivePrefixTreeStrategy strategy = new RecursivePrefixTreeStrategy(new GeohashPrefixTree(JtsSpatialContext.GEO, 11),
      "location");

  strategy.setDistErrPct(0);

  IndexWriterConfig conf = new IndexWriterConfig(new StandardAnalyzer());
  final RAMDirectory directory = new RAMDirectory();
  final IndexWriter writer = new IndexWriter(directory, conf);

  Shape point = JtsSpatialContext.GEO.getWktShapeParser().parse("POINT (9.4714708 47.6819432)");

  Shape polygon = JtsSpatialContext.GEO
      .getWktShapeParser()
      .parse(
          "POLYGON((9.481201171875 47.64885294675266,9.471416473388672 47.65128140482982,9.462661743164062 47.64781214443791,9.449443817138672 47.656947367880335,9.445838928222656 47.66110972448931,9.455795288085938 47.667352637215,9.469013214111328 47.67255449415724,9.477081298828125 47.679142768657066,9.490299224853516 47.678680460743834,9.506263732910156 47.679258344995326,9.51364517211914 47.68191653011071,9.518795013427734 47.677177931734406,9.526691436767578 47.679489496903706,9.53390121459961 47.67139857075435,9.50918197631836 47.66180341832901,9.50815200805664 47.6529003141482,9.51192855834961 47.64654002455372,9.504375457763672 47.64237650648966,9.49270248413086 47.649662445325035,9.48617935180664 47.65151268066222,9.481201171875 47.64885294675266))");

  Document doc = new Document();

  Assert.assertNotEquals(point.relate(polygon), SpatialRelation.INTERSECTS);
  for (IndexableField f : strategy.createIndexableFields(point)) {
    doc.add(f);
  }

  writer.addDocument(doc);
  writer.commit();

  SpatialArgs args = new SpatialArgs(SpatialOperation.Intersects, polygon.getBoundingBox());
  Filter filter = strategy.makeFilter(args);
  IndexReader reader = DirectoryReader.open(directory);

  IndexSearcher searcher = new IndexSearcher(reader);

  TopDocs search = searcher.search(new MatchAllDocsQuery(), filter, 1000);
  Assert.assertEquals(search.totalHits, 0);

  reader.close();
  writer.close();
}
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:41,代码来源:LuceneGeoTest.java

示例8: geoSpeedTestInternal

@Test
public void geoSpeedTestInternal() throws IOException, ParseException {

  RecursivePrefixTreeStrategy strategy = new RecursivePrefixTreeStrategy(new GeohashPrefixTree(JtsSpatialContext.GEO, 11),
      "location");

  IndexWriterConfig conf = new IndexWriterConfig(new StandardAnalyzer());
  final RAMDirectory directory = new RAMDirectory();
  final IndexWriter writer = new IndexWriter(directory, conf);

  ODocument entries = loadMultiPolygon();

  OMultiPolygonShapeBuilder builder = new OMultiPolygonShapeBuilder();

  Shape multiPolygon = builder.fromDoc(entries);

  Document doc = new Document();

  for (IndexableField f : strategy.createIndexableFields(multiPolygon)) {
    doc.add(f);
  }

  writer.addDocument(doc);
  writer.commit();

  writer.close();
}
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:27,代码来源:LuceneGeoTest.java


注:本文中的com.spatial4j.core.context.jts.JtsSpatialContext.GEO属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。