Skip to content

Commit

Permalink
Fix #1
Browse files Browse the repository at this point in the history
Loading classpath resource without the file system
  • Loading branch information
zwolsman committed Jun 16, 2018
1 parent 1b4d025 commit f8a38f0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/kotlin/com/s63d/tripmiddleware/utils/TripSplitter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ import java.nio.file.Files
import java.nio.file.Paths
import java.util.*
import javax.annotation.PostConstruct
import org.springframework.core.io.ClassPathResource
import org.springframework.util.StreamUtils


@Service
class TripSplitter {
Expand All @@ -31,8 +34,7 @@ class TripSplitter {
@PostConstruct
fun init() {
logger.info("Loading geometries..")
val path = Paths.get(javaClass.getResource("/countries.geojson").toURI())
val bytes = Files.readAllBytes(path)
val bytes = StreamUtils.copyToByteArray(ClassPathResource("/countries.geojson").inputStream)
val json = String(bytes)
val rawCountries = GeoJSONFactory.create(json) as FeatureCollection
val reader = GeoJSONReader()
Expand Down

0 comments on commit f8a38f0

Please sign in to comment.