flask-extensions / Flask-GoogleMaps

Easy way to add GoogleMaps to Flask applications. maintainer: @getcake
https://flask-googlemaps.com
MIT License
647 stars 196 forks source link

Issue with clustered maps #50

Open attiliovaccaro opened 7 years ago

attiliovaccaro commented 7 years ago

I tried to render a clustered map created as indicated in http://flaskgooglemaps.pythonanywhere.com/

I only have two markers, but as I zoom out they get grouped together but in the map only the number 2 is displayed with no icon. What am I doing wrong?

issue_flask_googlemaps

kaiofreitas commented 7 years ago

I have the same issue. it seems the image "m1.png" is missing.

Follow the steps below to add a marker clusterer: Get the marker clustering library and images from GitHub, and store them on a server accessible to your app. The JavaScript library and image files for the MarkerClusterer are available in the Google Maps repo on GitHub. Download or copy the following files from GitHub to a location accessible to your app: markerclusterer.js m1.png m2.png m3.png m4.png m5.png

https://github.com/googlemaps/v3-utility-library/tree/master/markerclusterer

kaiofreitas commented 7 years ago

How can I personalize the DEFAULT_CLUSTER_IMAGE_PATH without edit the sourcecode? Right now is: DEFAULT_CLUSTER_IMAGE_PATH = "static/images/m"

I need to change to DEFAULT_CLUSTER_IMAGE_PATH = "static/dist/images/m"

rochacbruno commented 7 years ago

If you are creating the Map object in backend it is customizable by passing the cluster_imagepath argument https://github.com/rochacbruno/Flask-GoogleMaps/blob/master/flask_googlemaps/__init__.py#L37

If you are using in a different way you can try monkey patching for now in the top of you file

import flasgger
flasgger.DEFAULT_CLUSTER_IMAGE_PATH = "static/dist/images/m"

app = Flask()
flasgger.Swagger(app)

I will think in a way to make it configurable

kaiofreitas commented 7 years ago

Passing cluster_imagepath works fine! Thanks!

mzorob commented 6 years ago

Hello,

First off, I just wanted to say thanks for this awesome library! I'm still having the same issue as kaiofreitas was having with the images m1-m5 images not showing up on my map. Im not entirely sure how but I had the images working yesterday but when I checked my site again this morning they were gone. I have the images downloaded and in my static/images/m directory and I have changed the default cluster image path variable in the init.py file within the package. Have I messed this up somehow?

mzorob commented 6 years ago

I figured out my issue, I know this probably isnt the best way to do this but what i did is just use the servers ip address /static/images/m for the url of the background image in the flask-googlemaps init.py file.