Fortunately, recent changes seem to have made the memory leaks I was 
experiencing a few weeks ago to vanish. Apologies for not playing a more 
active part in these discussions, but I'm finding there to be a quite 
steep learning curve here, and I don't have the time to make a major 
push to overcome it at once. But I finally have an import that I can 
play with in a Scala REPL, though I'm encountering things about it that 
just don't make sense.

My first goal is to find the nearest OSM node to a given lat, lon. My 
attempts seem to be made of fail thus far, however. Here's my code:

   def layer = spatialService.getLayer("map").asInstanceOf[OSMLayer]

   private def pointSearch(lat:Double, lon:Double) = new SearchClosest(
     layer.getGeometryFactory.createPoint(
       new Coordinate(lat, lon)
     )
   )

   def nearestNode(lat:Double, lon:Double) = {
     val query = pointSearch(lat, lon)
     val l = layer
     l.addSimpleDynamicLayer(Constants.GTYPE_POINT)
     l.getIndex.executeSearch(query)
     val results = query.getResults
     results.headOption.map { r =>
       r.getGeomNode
     }
   }

My thinking is that nodes should be represented as points, so I can't 
see why this fails. When I run this in a REPL, I do get a node back. So 
far so good. Next, I want to get the node's tags. So I run:

n.getSingleRelationship(OSMRelation.TAGS, Direction.INCOMING)

I get null. OK, so maybe this doesn't have tags. Yet, when I run:

n.getSingleRelationship(OSMRelationship.GEOM, 
Direction.INCOMING).getOtherNode(n).getPropertyKeys

I see what appears to be a series of tags (oneway, name, etc.) Why are 
these being returned for OSMRelation.GEOM rather than OSMRelation.TAGS?

Additionally, I see the property way_osm_id, which clearly isn't a tag. 
It would also seem to indicate that this query returned a way rather 
than a node like I'd hoped. This conclusion is further born out by the 
tag names. So clearly I'm not getting the search correct. But beyond 
that, the way being returned by this search isn't close to the lat,lon I 
provided. What am I missing?

As an aside, in looking at the latest OSM import testcase, it seems like 
the batch inserter may now be optional. Is this true, and what 
benefits/disadvantages are there to its use? I tried importing the Texas 
OSM data on my fairly powerful laptop, but gave up after 12 hours and 
170000 way imports (I think there are over a million in that dataset.) 
Other geospatial formats seem to do the import in a matter of hours, but 
this import seemed like it'd go on for days if I let it.

Thanks.
_______________________________________________
Neo4j mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to