Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ kotlin {
val modulesUsingJava11 = with(projects) {
setOf(
dataframeJupyter,
dataframeGeo,
dataframeGeoJupyter,
examples.ideaExamples.titanic,
tests,
plugins.dataframeGradlePlugin,
Expand Down
59 changes: 59 additions & 0 deletions dataframe-geo-jupyter/build.gradle.kts
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering, should this be a separate module? I think it can just be part of the dataframe-jupyter module, potentially with the useExperimentalGeo flag

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dataframe-geo is really heavy and I wouldn't like it to be a part of general dataframe artifact, neither %use dataframe in notebooks. So I'd really like to keep them separate

Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
with(libs.plugins) {
alias(kotlin.jvm)
alias(publisher)
alias(jupyter.api)
alias(ktlint)
alias(dataframe)
alias(ksp)
}
}

group = "org.jetbrains.kotlinx"

repositories {
// geo repository should come before Maven Central
maven("https://repo.osgeo.org/repository/release")
mavenCentral()
mavenLocal()
}

// https://stackoverflow.com/questions/26993105/i-get-an-error-downloading-javax-media-jai-core1-1-3-from-maven-central
// jai core dependency should be excluded from geotools dependencies and added separately
fun ExternalModuleDependency.excludeJaiCore() = exclude("javax.media", "jai_core")

dependencies {
implementation(projects.dataframeGeo)
implementation(projects.dataframeJupyter)

implementation(libs.geotools.referencing) { excludeJaiCore() }

// logger, need it for geotools
implementation(libs.log4j.core)
implementation(libs.log4j.api)

testImplementation(kotlin("test"))
}

tasks.withType<KotlinCompile>().configureEach {
friendPaths.from(project(projects.core.path).projectDir)
}

kotlinPublications {
publication {
publicationName = "dataframeGeoJupyter"
artifactId = project.name
description = "GeoDataFrame API"
packageName = artifactId
}
}

tasks.processJupyterApiResources {
libraryProducers = listOf("org.jetbrains.kotlinx.dataframe.jupyter.IntegrationGeo")
}

tasks.test {
useJUnitPlatform()
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ internal class IntegrationGeo : JupyterIntegration() {
useSchema<WithMultiLineStringGeometry>()
}

render<GeoDataFrame<*>> {
println("GeoDataFrame with ${it.crs} CRS and inner dataframe:")
it.df
}

val replCodeGeneratorImpl = ReplCodeGeneratorImpl()
replCodeGeneratorImpl.process(WithGeometry::class)
replCodeGeneratorImpl.process(WithPolygonGeometry::class)
Expand All @@ -67,7 +72,7 @@ internal class IntegrationGeo : JupyterIntegration() {
val generatedDf = execute(
codeWithTypeCastGenerator = replCodeGeneratorImpl.process(geo.df, kProperty),
expression = "(${kProperty.name}.df as DataFrame<*>)",
)
).let { "`" + it.toString() + "`" }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"`$it`" is a bit shorter ;P

But what does this do? It renders the DF as string and adds crs? Isn't it better to output the DF natively and output CRS as string?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean by "this"?
FieldHandlerFactory.createUpdateExecution<GeoDataFrame<*>> adds inner df schema retrieving for jupuyter.
new render section adds a new render for geodf like that:
image

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice :)

Is it always static, though? or is that just your screenshot?

val name = execute("GeoDataFrame($generatedDf, ${kProperty.name}.crs)").name
name
}
Expand Down
14 changes: 6 additions & 8 deletions dataframe-geo/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ plugins {
with(libs.plugins) {
alias(kotlin.jvm)
alias(publisher)
alias(jupyter.api)
alias(ktlint)
alias(dataframe)
alias(ksp)
Expand All @@ -14,7 +13,7 @@ plugins {
group = "org.jetbrains.kotlinx"

repositories {
// geo repository should come before Maven Central
// osgeo repository should come before Maven Central
maven("https://repo.osgeo.org/repository/release")
mavenCentral()
mavenLocal()
Expand All @@ -26,19 +25,22 @@ fun ExternalModuleDependency.excludeJaiCore() = exclude("javax.media", "jai_core

dependencies {
api(projects.core)
implementation(projects.dataframeJupyter)

// Geotools
implementation(libs.geotools.main) { excludeJaiCore() }
implementation(libs.geotools.shapefile) { excludeJaiCore() }
implementation(libs.geotools.geojson) { excludeJaiCore() }
implementation(libs.geotools.referencing) { excludeJaiCore() }
implementation(libs.geotools.epsg.hsql) { excludeJaiCore() }

// JAI
implementation(libs.jai.core)

// JTS
implementation(libs.jts.core)
implementation(libs.jts.io.common)

// Ktor
implementation(libs.ktor.client.core)
implementation(libs.ktor.client.cio)
implementation(libs.ktor.client.content.negotiation)
Expand All @@ -54,16 +56,12 @@ tasks.withType<KotlinCompile>().configureEach {
kotlinPublications {
publication {
publicationName = "dataframeGeo"
artifactId = "dataframe-geo"
artifactId = project.name
description = "GeoDataFrame API"
packageName = artifactId
}
}

tasks.processJupyterApiResources {
libraryProducers = listOf("org.jetbrains.kotlinx.dataframe.jupyter.IntegrationGeo")
}

tasks.test {
useJUnitPlatform()
}
6 changes: 6 additions & 0 deletions dataframe-jupyter/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,17 @@ repositories {
mavenCentral()
}


dependencies {
api(projects.dataframe)

// logger, need it for apache poi
implementation(libs.log4j.core)
implementation(libs.log4j.api)

testImplementation(libs.junit)
testImplementation(libs.serialization.json)

// experimental
testImplementation(projects.dataframeOpenapiGenerator)
testImplementation(projects.dataframeOpenapi)
Expand Down
8 changes: 8 additions & 0 deletions examples/android-example/local.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## This file must *NOT* be checked into Version Control Systems,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to remove this file :D

# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Fri Aug 01 16:02:03 AMT 2025
sdk.dir=/Users/andrei.kislitsyn/Library/Android/sdk
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ include("dataframe-jdbc")
include("dataframe-csv")
include("dataframe-jupyter")
include("dataframe-geo")
include("dataframe-geo-jupyter")
include("dataframe-openapi-generator")
include("core")
include("dataframe-compiler-plugin-core")
Expand Down