generated from NYCPlanning/ae-remix-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fcb4acd
commit 833f172
Showing
3 changed files
with
49 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export { useCapitalProjectsLayer } from "./useCapitalProjectsLayer.client"; | ||
export { useCommunityDistrictsLayer } from "./useCommunityDistrictsLayer.client"; | ||
export { useCityCouncilDistrictsLayer } from "./useCityCouncilDistrictsLayer.client"; |
37 changes: 37 additions & 0 deletions
37
app/components/layers/useCityCouncilDistrictsLayer.client.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { MVTLayer } from "@deck.gl/geo-layers"; | ||
import { useSearchParams } from "@remix-run/react"; | ||
|
||
export interface CityCouncilDistrictProperties { | ||
layerName: string; | ||
id: string; | ||
} | ||
export function useCityCouncilDistrictsLayer() { | ||
const [searchParams, setSearchParams] = useSearchParams(); | ||
const districtType = searchParams.get("districtType"); | ||
|
||
return new MVTLayer<CityCouncilDistrictProperties>({ | ||
id: "CityCouncilDistricts", | ||
data: [ | ||
`${import.meta.env.VITE_ZONING_API_URL}/api/city-council-districts/{z}/{x}/{y}.pbf`, | ||
], | ||
visible: districtType === "ccd", | ||
uniqueIdProperty: "boroughIdCityCouncilDistrictId", | ||
pickable: true, | ||
getPointRadius: 5, | ||
filled: false, | ||
getLineColor: [113, 128, 150, 255], | ||
getLineWidth: 3, | ||
lineWidthUnits: "pixels", | ||
pointType: "text", | ||
getText: ({ properties }: { properties: CityCouncilDistrictProperties }) => | ||
properties.id, | ||
getTextColor: [98, 98, 98, 255], | ||
textFontFamily: "Helvetica Neue, Arial, sans-serif", | ||
getTextSize: 15, | ||
textFontSettings: { | ||
sdf: true, | ||
}, | ||
textOutlineColor: [255, 255, 255, 255], | ||
textOutlineWidth: 2, | ||
}); | ||
} |