Skip to content

Commit

Permalink
Merge 7409af7 into 7426549
Browse files Browse the repository at this point in the history
  • Loading branch information
cka-y authored Oct 16, 2024
2 parents 7426549 + 7409af7 commit ac8e8d2
Show file tree
Hide file tree
Showing 27 changed files with 1,098 additions and 334 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright 2024 MobilityData LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mobilitydata.gtfsvalidator.notice;

import static org.mobilitydata.gtfsvalidator.notice.SeverityLevel.ERROR;

import org.mobilitydata.gtfsvalidator.annotation.GtfsValidationNotice;

/**
* A polygon in `locations.geojson` is unparsable or invalid.
*
* <p>Each polygon must be valid by the definition of the <a
* href="http://www.opengis.net/doc/is/sfa/1.2.1" target="_blank"> OpenGIS Simple Features
* Specification, section 6.1.11 </a>.
*/
@GtfsValidationNotice(severity = ERROR)
public class InvalidGeometryNotice extends ValidationNotice {

/** The id of the faulty record. */
private final String featureId;

/** The geometry type of the feature containing the invalid polygon. */
private final String geometryType;

/** The validation error details. */
private final String message;

public InvalidGeometryNotice(String featureId, String geometryType, String validationError) {
this.featureId = featureId;
this.geometryType = geometryType;
this.message = validationError;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright 2024 MobilityData LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mobilitydata.gtfsvalidator.notice;

import static org.mobilitydata.gtfsvalidator.notice.SeverityLevel.ERROR;

import org.mobilitydata.gtfsvalidator.annotation.GtfsValidationNotice;

/** A JSON file is malformed. */
@GtfsValidationNotice(severity = ERROR)
public class MalformedJsonNotice extends ValidationNotice {

/** The name of the faulty file. */
private final String filename;

public MalformedJsonNotice(String filename) {
this.filename = filename;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright 2024 MobilityData LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mobilitydata.gtfsvalidator.notice;

import static org.mobilitydata.gtfsvalidator.notice.SeverityLevel.ERROR;

import org.mobilitydata.gtfsvalidator.annotation.GtfsValidationNotice;

/** A required element is missing in `locations.geojson`. */
@GtfsValidationNotice(severity = ERROR)
public class MissingRequiredElementNotice extends ValidationNotice {
/** Index of the feature in the feature collection. */
private final Integer featureIndex;

/** The id of the faulty record. */
private final String featureId;

/** The missing required element. */
private final String missingElement;

public MissingRequiredElementNotice(
String featureId, String missingElement, Integer featureIndex) {
this.featureId = featureId;
this.featureIndex = featureIndex;
this.missingElement = missingElement;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright 2024 MobilityData LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mobilitydata.gtfsvalidator.notice;

import static org.mobilitydata.gtfsvalidator.notice.SeverityLevel.ERROR;

import org.mobilitydata.gtfsvalidator.annotation.GtfsValidationNotice;

/**
* An unsupported feature type is used in the `locations.geojson` file.
*
* <p>Use `Feature` instead to comply with the spec.
*/
@GtfsValidationNotice(severity = ERROR)
public class UnsupportedFeatureTypeNotice extends ValidationNotice {

/** The value of the unsupported GeoJSON type. */
Integer featureIndex;

/** The id of the faulty record. */
String featureId;

/** The feature type of the faulty record. */
String featureType;

public UnsupportedFeatureTypeNotice(Integer featureIndex, String featureId, String featureType) {
this.featureIndex = featureIndex;
this.featureId = featureId;
this.featureType = featureType;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright 2024 MobilityData LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mobilitydata.gtfsvalidator.notice;

import static org.mobilitydata.gtfsvalidator.notice.SeverityLevel.ERROR;

import org.mobilitydata.gtfsvalidator.annotation.GtfsValidationNotice;

/**
* An unsupported GeoJSON type is used in the `locations.geojson` file.
*
* <p>Use `FeatureCollection` instead to comply with the spec.
*/
@GtfsValidationNotice(severity = ERROR)
public class UnsupportedGeoJsonTypeNotice extends ValidationNotice {

/** The value of the unsupported GeoJSON type. */
private final String geoJsonType;

public UnsupportedGeoJsonTypeNotice(String geoJsonType) {
this.geoJsonType = geoJsonType;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright 2024 MobilityData LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mobilitydata.gtfsvalidator.notice;

import static org.mobilitydata.gtfsvalidator.notice.SeverityLevel.ERROR;

import org.mobilitydata.gtfsvalidator.annotation.GtfsValidationNotice;

/**
* A GeoJSON feature has an unsupported geometry type in `locations.geojson`.
*
* <p>Each feature must have a geometry type that is supported by the GTFS spec. The supported
* geometry types `Polygon` and `MultiPolygon`.
*/
@GtfsValidationNotice(severity = ERROR)
public class UnsupportedGeometryTypeNotice extends ValidationNotice {

/** The index of the feature in the feature collection. */
private final int featureIndex;

/** The id of the faulty record. */
private final String featureId;

/** The geometry type of the faulty record. */
private final String geometryType;

public UnsupportedGeometryTypeNotice(int featureIndex, String featureId, String geometryType) {
this.featureIndex = featureIndex;
this.featureId = featureId;
this.geometryType = geometryType;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
* This class is the parent of containers holding table (csv) entities and containers holding JSON
* entities
*
* @param <T> The entity for this container (e.g. GtfsCalendarDate or GtfsGeojsonFeature )
* @param <T> The entity for this container (e.g. GtfsCalendarDate or GtfsGeoJsonFeature )
* @param <D> The descriptor for the file for the container (e.g. GtfsCalendarDateTableDescriptor or
* GtfsGeojsonFileDescriptor)
* GtfsGeoJsonFileDescriptor)
*/
public abstract class GtfsEntityContainer<T extends GtfsEntity, D extends GtfsFileDescriptor> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

/**
* This class provides some info about the different files within a GTFS dataset. Its children
* relate to either a csv table or a geojson file.
* relate to either a csv table or a GeoJSON file.
*
* @param <T> The entity that will be extracted from the file. For example, GtfsCalendarDate or
* GtfsGeojsonFeature
* GtfsGeoJsonFeature
*/
public abstract class GtfsFileDescriptor<T extends GtfsEntity> {

Expand Down
1 change: 1 addition & 0 deletions main/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ dependencies {
implementation 'org.thymeleaf:thymeleaf:3.0.15.RELEASE'
implementation 'com.vladsch.flexmark:flexmark-all:0.64.8'
implementation 'io.github.classgraph:classgraph:4.8.146'
implementation 'org.locationtech.jts:jts-core:1.20.0'
testImplementation group: 'junit', name: 'junit', version: '4.13'
testImplementation 'com.google.truth:truth:1.0.1'
testImplementation 'com.google.truth.extensions:truth-java8-extension:1.0.1'
Expand Down
Loading

0 comments on commit ac8e8d2

Please sign in to comment.