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

[BUG] Fix Incident Mapping Errors #303

Open
DMalone87 opened this issue Aug 26, 2023 · 4 comments
Open

[BUG] Fix Incident Mapping Errors #303

DMalone87 opened this issue Aug 26, 2023 · 4 comments
Labels
bug Something isn't working frontend

Comments

@DMalone87
Copy link
Collaborator

Describe the bug
Both the search page and the incident view page are failing to properly map incidents. On the Search page with the map, the incidents are not showing up as markers on the map.

Screenshot 2023-08-26 at 3 17 05 PM

On the Results page, there's a crash as soon as you attempt to load.

Screenshot 2023-08-26 at 3 19 03 PM

To Reproduce
Steps to reproduce the behavior:

  1. Register/Log in
  2. Navigate to /search (You may need to refresh the database as we've made a number of changes)
  3. Attempt a search with no search terms entered. You should see all results returned. There will be no markers on the map.
  4. Click the "Full >" Link on one of the records.

Expected behavior
When a search is entered, all of the results from that search should show up as markers on the map. When you click on the Full link, you should be taken to a page where the location of the incident is shown on a satellite map.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: Desktop
  • OS: Ventura
  • Browser Safari
  • Version 16
@DMalone87
Copy link
Collaborator Author

One issue I noticed right off the bat: on this page, incident.locationLatLon doesn't actually return anything as the code is written now. If we want to return a value this way, we'll need to add a function to the Incident Model.

I tried making the existing location.longitude and location.latitude (which are being filled) into an array, but that didn't seem to work even though it fits the expected data.

  const createFeature = (incident: Incident) => {
    const feature: Feature = {
      type: "Feature",
      properties: { ...incident, locationLonLat: projection([incident.longitude, incident.latitude]) },
      geometry: { type: "Point", coordinates: projection([incident.longitude, incident.latitude]) }
    }
    return feature

@DMalone87
Copy link
Collaborator Author

@sashamaryl, I know it's been a while, but do you have any thoughts?

@DMalone87
Copy link
Collaborator Author

Some additional insight into the issues here:

  1. There's a reference to an API key meant to be delivered through an environment variable, NEXT_PUBLIC_MAPS_KEY, that doesn't actually exist outside of the two files that attempt to call it, Incident View Header Index and Incident Google Map Index.
  2. The Google Maps API Loader is invoked twice on the Incident View page, once in the header and once for the map itself. This double loading itself causes an error once the key is added. Also, the header invokation appears to fail anyway, even if with a valid key.

@DMalone87
Copy link
Collaborator Author

These functions (Search Panel Map) are coming from D3: https://github.com/d3/d3-geo

@DMalone87 DMalone87 added bug Something isn't working frontend labels Aug 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working frontend
Projects
None yet
Development

No branches or pull requests

1 participant