Skip to content

Commit

Permalink
psp-7607 correct property util function null/undefined handling. (#3787)
Browse files Browse the repository at this point in the history
Co-authored-by: Smith <Devin.Smith@quartech.com>
  • Loading branch information
devinleighsmith and Smith authored Feb 14, 2024
1 parent 6d0a526 commit 6998257
Show file tree
Hide file tree
Showing 5 changed files with 426 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ interface ParcelSeed {
pid?: string;
}

const largeMockParcels: ParcelSeed[] = [
export const largeMockParcels: ParcelSeed[] = [
{ id: 1, latitude: 53.917061, longitude: -122.749672 },
{ id: 2, latitude: 53.917062, longitude: -122.749692 },
{ id: 3, latitude: 53.917063, longitude: -122.749682 },
Expand All @@ -92,14 +92,14 @@ const largeMockParcels: ParcelSeed[] = [
{ id: 11, latitude: 53.918172, longitude: -122.749772 },
];

const distantMockParcels: ParcelSeed[] = [
export const distantMockParcels: ParcelSeed[] = [
{ id: 1, latitude: 53.917061, longitude: -122.749672, propertyId: '1' },
{ id: 2, latitude: 54.917062, longitude: -123.749692, propertyId: '2' },
{ id: 3, latitude: 55.917063, longitude: -124.749682, propertyId: '3' },
{ id: 4, latitude: 56.917064, longitude: -125.749672, propertyId: '4' },
];

const createPimsFeatures = (
export const createPimsFeatures = (
parcelSeed: ParcelSeed[],
): FeatureCollection<Point, PIMS_Property_Location_View> => {
return {
Expand Down
82 changes: 80 additions & 2 deletions source/frontend/src/mocks/faParcelLayerResponse.mock.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export const mockFAParcelLayerResponse = {
import { FeatureCollection, GeoJsonProperties, Geometry } from 'geojson';

export const mockFAParcelLayerResponse: FeatureCollection<Geometry, GeoJsonProperties> = {
type: 'FeatureCollection',
features: [
{
Expand Down Expand Up @@ -69,4 +71,80 @@ export const mockFAParcelLayerResponse = {
},
},
bbox: [-132.1709, 48.3528, -114.6927, 56.8488],
};
} as unknown as FeatureCollection<Geometry, GeoJsonProperties>;

export const mockFAParcelLayerResponseMultiPolygon: FeatureCollection<Geometry, GeoJsonProperties> =
{
type: 'FeatureCollection',
features: [
{
type: 'Feature',
id: 'PMBC_PARCEL_POLYGON_FABRIC.551',
geometry: {
type: 'MultiPolygon',
coordinates: [
[
[
[-123.46, 48.767],
[-123.4601, 48.7668],
[-123.461, 48.7654],
[-123.4623, 48.7652],
[-123.4627, 48.7669],
[-123.4602, 48.7672],
[-123.4601, 48.7672],
[-123.4601, 48.7672],
[-123.46, 48.767],
],
],
],
},
geometry_name: 'SHAPE',
properties: {
GLOBAL_UID: '{4C4D758A-1261-44C1-8835-0FEB93150495}',
PARCEL_NAME: '009727493',
PLAN_ID: 3,
PLAN_NUMBER: 'NO_PLAN',
PIN: null,
PID: '9727493',
PID_NUMBER: null,
SOURCE_PARCEL_ID: null,
PARCEL_STATUS: 'ACTIVE',
PARCEL_CLASS: 'SUBDIVISION',
OWNER_TYPE: 'CROWN PROVINCIAL',
PARCEL_START_DATE: null,
SURVEY_DESIGNATION_1: 'PART 13',
SURVEY_DESIGNATION_2: 'SOUTH SALT SPRING,1',
SURVEY_DESIGNATION_3: '',
LEGAL_DESCRIPTION:
'THAT PART OF SECTION 13, RANGE 1, SOUTH SALT SPRING ISLAND, COWICHAN DISTRICT',
MUNICIPALITY: '0163',
REGIONAL_DISTRICT: '0005',
IS_REMAINDER_IND: 'NO',
GEOMETRY_SOURCE: 'MODIFIED-ICIS',
POSITIONAL_ERROR: 2,
ERROR_REPORTED_BY: 'DATACOMPILATION',
CAPTURE_METHOD: 'UNKNOWN',
COMPILED_IND: '1',
STATED_AREA: null,
WHEN_CREATED: '2016-01-06T17:44:42Z',
WHEN_UPDATED: '2019-01-05T10:21:32Z',
FEATURE_AREA_SQM: 29217,
FEATURE_LENGTH_M: 702,
OBJECTID: 551,
SE_ANNO_CAD_DATA: null,
},
bbox: [-123.4627, 48.7652, -123.46, 48.7672],
},
],
totalFeatures: 1,
numberMatched: 1,
numberReturned: 1,
timeStamp: '2022-06-10T20:15:54.003Z',
crs: {
type: 'name',
properties: {
name: 'urn:ogc:def:crs:EPSG::4326',
},
},
bbox: [-132.1709, 48.3528, -114.6927, 56.8488],
} as unknown as FeatureCollection<Geometry, GeoJsonProperties>;
112 changes: 112 additions & 0 deletions source/frontend/src/mocks/featureset.mock.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
import { LocationFeatureDataset } from '@/components/common/mapFSM/useLocationFeatureLoader';

export const getMockLocationFeatureDataset = (): LocationFeatureDataset =>
({
location: {
lat: 48.432802005,
lng: -123.310041775,
},
pimsFeature: {
properties: null,
type: 'Feature',
geometry: {
type: 'Point',
coordinates: [-123.310041775, 48.432802005],
},
},
parcelFeature: {
type: 'Feature',
id: 'WHSE_CADASTRE.PMBC_PARCEL_FABRIC_POLY_SVW.fid--55c55c24_18d9ff61aac_-5aaa',
geometry: {
type: 'Polygon',
coordinates: [[[-123.31014591, 48.43274258]]],
},
geometry_name: 'SHAPE',
properties: {
PARCEL_FABRIC_POLY_ID: 6103848,
PARCEL_NAME: '000002500',
PLAN_NUMBER: 'VIP3881',
PIN: null,
PID: '000002500',
PID_FORMATTED: '000-002-500',
PID_NUMBER: 2500,
PARCEL_STATUS: 'Active',
PARCEL_CLASS: 'Subdivision',
OWNER_TYPE: 'Private',
PARCEL_START_DATE: null,
MUNICIPALITY: 'Oak Bay, The Corporation of the District of',
REGIONAL_DISTRICT: 'Capital Regional District',
WHEN_UPDATED: '2022-03-24Z',
FEATURE_AREA_SQM: 647.4646,
FEATURE_LENGTH_M: 109.0764,
OBJECTID: 848479361,
SE_ANNO_CAD_DATA: null,
},
},
regionFeature: {
type: 'Feature',
id: 'WHSE_ADMIN_BOUNDARIES.TADM_MOT_REGIONAL_BNDRY_POLY.1',
geometry: {
type: 'Polygon',
coordinates: [[[-126.05000031, 51.9999999]]],
},
geometry_name: 'GEOMETRY',
properties: {
REGION_NUMBER: 1,
FEATURE_CODE: null,
REGION_NAME: 'South Coast',
OBJECTID: 20273,
SE_ANNO_CAD_DATA: null,
FEATURE_AREA_SQM: 151439012177.005,
FEATURE_LENGTH_M: 2098978.5042,
},
},
districtFeature: {
type: 'Feature',
id: 'WHSE_ADMIN_BOUNDARIES.TADM_MOT_DISTRICT_BNDRY_POLY.2',
geometry: {
type: 'Polygon',
coordinates: [[[-125.86634507, 50.38795075]]],
},
geometry_name: 'GEOMETRY',
properties: {
DISTRICT_NUMBER: 2,
DISTRICT_NAME: 'Vancouver Island',
FEATURE_CODE: null,
OBJECTID: 52285,
SE_ANNO_CAD_DATA: null,
FEATURE_AREA_SQM: 65831400828.9239,
FEATURE_LENGTH_M: 1340187.9529,
},
},
municipalityFeature: {
type: 'Feature',
id: 'WHSE_LEGAL_ADMIN_BOUNDARIES.ABMS_MUNICIPALITIES_SP.265',
geometry: {
type: 'Polygon',
coordinates: [[[-123.29632516, 48.42581565]]],
},
geometry_name: 'SHAPE',
properties: {
LGL_ADMIN_AREA_ID: 265,
ADMIN_AREA_NAME: 'The Corporation of the District of Oak Bay',
ADMIN_AREA_ABBREVIATION: 'Oak Bay',
ADMIN_AREA_BOUNDARY_TYPE: 'Legal',
ADMIN_AREA_GROUP_NAME: 'Capital Regional District',
CHANGE_REQUESTED_ORG: 'MUNI',
UPDATE_TYPE: 'E',
WHEN_UPDATED: null,
MAP_STATUS: 'Not Appended',
OIC_MO_NUMBER: '665',
OIC_MO_YEAR: '1981',
OIC_MO_TYPE: 'OIC',
WEBSITE_URL: null,
IMAGE_URL: null,
AFFECTED_ADMIN_AREA_ABRVN: null,
FEATURE_AREA_SQM: 15719635.1334,
FEATURE_LENGTH_M: 20852.8728,
OBJECTID: 13892,
SE_ANNO_CAD_DATA: null,
},
},
} as unknown as LocationFeatureDataset);
Loading

0 comments on commit 6998257

Please sign in to comment.