Skip to content

Conversation

@gav228
Copy link

@gav228 gav228 commented Dec 9, 2019

Related Issues
Make a digital/interactive map of Downtown Troy #110

Describe the Changes
Added a model in the models.py file for a map page and an accompanying html file that parses wagtail data and renders a google maps on the page.

Still To Do
The map could use some styling optimizations

Problems
If someone clicks on the satelite imagery or geographic buttons on the map page, the cleared out markers come back. Basically it becomes less blank which draws attention away from what we may be trying to highlight. One of the potential style optimizations we could look at.

Testing
I used the pipeline admin page to create a mappage, then added locations to the map page to verify they displayed properly with the right locations

@jlyon1
Copy link
Member

jlyon1 commented Dec 10, 2019

This needs a reformat of

would reformat /home/travis/build/thepoly/pipeline/core/migrations/0005_mappage.py
would reformat /home/travis/build/thepoly/pipeline/core/migrations/0006_mappage_places.py
would reformat /home/travis/build/thepoly/pipeline/core/models.py

Copy link
Member

@jlyon1 jlyon1 left a comment

Choose a reason for hiding this comment

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

This does work, just a few things that I think need to be addressed before we deploy this.

One other question I have: Does the google maps license allow us to do this? I generally prefer open street maps to google maps in general as well.

* The callback parameter executes the initMap() function
-->
<script async defer
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyD2QD1ngZzv0QjZhylFw0T4_22hzOMjx34&callback=initMap">
Copy link
Member

Choose a reason for hiding this comment

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

Is this the browser api key? if it is not, embedding it in the frontend will expose the key to the user and could potentially expose us to other people using our key for things we did not intend. We should request the information we need (lat, lng, etc) on the backend and send the information down

Copy link
Author

Choose a reason for hiding this comment

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

Yeah in addition to open streets map, I plan on looking into a few other open source map options. Notably, Mapbox, Leaflet, Modest Maps, and Polymaps. Whichever seems to work best. I'll also get on replacing address with lat lng in admin panel.


DATABASES = {
"default": dj_database_url.config(default="postgres://127.0.0.1:5432/pipeline")
"default": dj_database_url.config(default="postgresql://postgres:gav228@/pipeline")
Copy link
Member

Choose a reason for hiding this comment

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

Should not change this

DATABASES = {
"default": dj_database_url.config(
default="postgresql://postgres:postgres@127.0.0.1:5432/pipeline"
default="postgresql://postgres:gav228@127.0.0.1:5432/pipeline"
Copy link
Member

Choose a reason for hiding this comment

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

should not change this

Copy link
Author

@gav228 gav228 Dec 11, 2019

Choose a reason for hiding this comment

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

will resolve in my next commit along with other quickfixes (console logs, lat, lng etc)

for(i=0;i<window.parsedaddresses.length;i++){
console.log(window.parsedaddresses[i]);
console.log(i);
geocoder.geocode( { 'address': window.parsedaddresses[i]}, function(results, status) {
Copy link
Member

Choose a reason for hiding this comment

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

I'm afraid geocoding the addresses on the frontend for all clients will cause us to hit a rate limit rather quickly once deployed. Perhaps we should request the latitude and longitude on map creation/update and store those lat/lng values then

// create markers per address
for(i=0;i<window.parsedaddresses.length;i++){
console.log(window.parsedaddresses[i]);
console.log(i);
Copy link
Member

Choose a reason for hiding this comment

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

Should also remove the console logs.

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.

3 participants