Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Geo #449

Open
wants to merge 18 commits into
base: dev
Choose a base branch
from
Open

Geo #449

wants to merge 18 commits into from

Conversation

AndreiKingsley
Copy link
Collaborator

No description provided.

if (dataset is GeoSpatialData) {
dataset
} else {
null
Copy link

Choose a reason for hiding this comment

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

If we return null, is it possible to log here something with warning? or throw an exception if we don't handle null higher

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There is no error here, it is a note that in the Lets-Plot specification it is impossible to pass geodataset as main (default for layers), so if we have a main geodatset in kandy, it should be passed to each layer separately during processing and that's exactly what's going here.

featureBuffer.add(LayerWrapper(this, addGroups, dataset?.wrap(), mappings, settings, groupKeys))
val map = if (dataset is GeoSpatialData) {
dataset.toSpatialDataset()
} else null
Copy link

Choose a reason for hiding this comment

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

How should be these null handled?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It shouldn't, it's a feature of the Lets-Plot specification, which is described in the previous conversation

import org.jetbrains.kotlinx.kandy.ir.data.TableData
import org.jetbrains.letsPlot.spatial.SpatialDataset

public interface GeoSpatialData: TableData {
Copy link

Choose a reason for hiding this comment

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

Please, generate and fill KDocs

import org.locationtech.jts.geom.MultiPolygon
import org.locationtech.jts.operation.union.CascadedPolygonUnion


Copy link

Choose a reason for hiding this comment

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

Remove empty line and add some KDocs, great that exception is raised? Could we throw IllegalArgumentException in other situation which I commented?

) {
geometry().forEach {
if (it !is Polygonal) {
error("Not a polygon geometry: $it")
Copy link

Choose a reason for hiding this comment

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

why it somewhere IllegalArgumentException, somewhere error? could it be unified through the PR?

Copy link

Choose a reason for hiding this comment

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

Also KDocs required

import org.locationtech.jts.geom.Puntal
import kotlin.reflect.typeOf

// TODO add ColumnAccessor & String api
Copy link

Choose a reason for hiding this comment

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

TODO: add KDocs


package org.jetbrains.kotlinx.kandy.letsplot.geo.dsl

public sealed interface GeoDataScope
Copy link

Choose a reason for hiding this comment

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

Is it really required a separate file?

}
}

@PublishedApi
Copy link

@zaleslaw zaleslaw Dec 2, 2024

Choose a reason for hiding this comment

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

Sorry, is it @PublishedApi and internal in the same time? Is it correct?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

But @PublishedApi is applicable only for internal properties :)

import org.jetbrains.kotlinx.kandy.dsl.internal.LayerCreatorScope
import org.jetbrains.kotlinx.kandy.dsl.internal.MultiLayerPlotBuilder

public class GeoDataFrameScope<T : WithGeometry>(
Copy link

Choose a reason for hiding this comment

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

KDocs please

import org.jetbrains.kotlinx.kandy.dsl.internal.DatasetBuilder
import org.jetbrains.kotlinx.kandy.dsl.internal.dataframe.MultiLayerPlotBuilderImpl

public class GeoDataFramePlotBuilder<T : WithGeometry> @PublishedApi internal constructor(
Copy link

Choose a reason for hiding this comment

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

KDocs please

override fun toSpatialDataset(): SpatialDataset {
with(geoDataFrame) {
// TODO encoding precision
val geojson = GeometryJSON(10)
Copy link

Choose a reason for hiding this comment

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

Magic Constant - should be extracted and explained

with(geoDataFrame) {
// TODO encoding precision
val geojson = GeometryJSON(10)
return SpatialDataset.withGEOJSON(
Copy link

Choose a reason for hiding this comment

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

is it possible to rename to withGeoJson to be more Kotlinish?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's not our API

val friendModules = listOf(project(":kandy-api"), project(":kandy-lets-plot"))
val jarTasks = friendModules.map { it.tasks.getByName("jar") as Jar }
val jarPaths = jarTasks.map { it.archiveFile.get().asFile.absolutePath }
(this as BaseKotlinCompile).friendPaths.from(jarPaths)
Copy link

Choose a reason for hiding this comment

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

could please add some note or explanation about why do we need friend modules here?

// jai core dependency should be excluded from geotools dependencies and added separately
fun ExternalModuleDependency.excludeJaiCore() = exclude("javax.media", "jai_core")


Copy link

Choose a reason for hiding this comment

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

remove blank lines

Copy link

@zaleslaw zaleslaw left a comment

Choose a reason for hiding this comment

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

It requires more work on KDocs and some questions should be answered also

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants