Skip to content

Instantly share code, notes, and snippets.

@mavenik
Created September 15, 2012 18:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mavenik/3729169 to your computer and use it in GitHub Desktop.
Save mavenik/3729169 to your computer and use it in GitHub Desktop.
Neo4j Spatial Import
import org.neo4j.gis.spatial.osm.OSMImporter;
import org.neo4j.kernel.impl.batchinsert.BatchInserter;
import org.neo4j.kernel.impl.batchinsert.BatchInserterImpl;
import java.io.IOException;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.kernel.EmbeddedGraphDatabase;
class SpatialOsmImport {
public static void main(String[] args)
{
/**
* args[0] -> OSM name
* args[1] -> Graph data path
* args[2] -> OSM File path
**/
System.out.println("Looks like the OSMImporter was imported! :P");
OSMImporter importer = new OSMImporter(args[0].toString());
BatchInserter batchinserter = new BatchInserterImpl(args[1].toString());
try{
importer.importFile(batchinserter, args[2].toString(), false);
GraphDatabaseService db = new EmbeddedGraphDatabase(args[1]);
importer.reIndex(db, 10000);
db.shutdown();
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
batchinserter.shutdown();
}
}
@amhg
Copy link

amhg commented Jul 18, 2015

Hello Mavenik, i'm not sure if i'm allowed to ask you something via GitHub, could you please tell me another way to contact you?, thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment