Created
September 15, 2012 18:24
-
-
Save mavenik/3729169 to your computer and use it in GitHub Desktop.
Neo4j Spatial Import
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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