Issue #6 resolved

Not Getting It

skizzy
created an issue

Hi, hope all is well? I installed Django-easy-maps, and I'm confused on how to use it.

I created a view and a template for it, but when I visit the page, it's always bringing a blank page. What I'm I missing?

Template: % load easy_maps_tags %}

<!-- Default map with 300x400 dimensions --> {# {% easy_map "Russia, Ekaterinburg, Mira 32" 300 400 %} #}

<!-- Variable address, custom detail level and custom template --> {% easy_map address 200 200 5 using 'easy_maps/map.html' %}

View: def geo(request): return render_to_response('geomap.html')

I'm thinking its supposed to bring a field where I can iput where I want to locate. Or is that not so? Please kindly help a niib out.

Thanks!

Comments (19)

  1. Mikhail Korobov repo owner

    Hi skizzy,

    Doesn't

    <html>
    <body>
    {% load easy_maps_tags %}
    {% easy_map "Russia, Ekaterinburg, Mira 32" 300 400 %}
    </body>
    </html>
    

    work?

    easy_map tag just accepts string with the address and this address can come from the model field or be hardcoded in template.

  2. skizzy reporter

    Thanks for the reply. Yeah, it's not working. Should I create a model or what? Sorry, I didn't get you. Hope to hear from you soon. Take care.

  3. skizzy reporter

    Template:

    <html> <body>

    {% load easy_maps_tags %} {% easy_map "Russia, Ekaterinburg, Mira 32" 300 400 %}

    {% easy_map address 200 200 5 using 'easy_maps/map.html' %} </body> </html>

    Views:

    def geomap(request): return render_to_response('geomap.html')

    When I visit, localhost:8000/geomap , It will only load a blank page! Just white blank page. That's all.

  4. Mikhail Korobov repo owner

    Can you please post the HTML of this blank page? Use 'view source' or 'save as' in your browser. If the html looks good then check the javascript errors in browser console.

  5. skizzy reporter

    <html> <body>

    <!-- Google Maps API javascript --> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>

    <!-- HTML map container --> <div id="map-canvas-1"

    class="easy-map-googlemap">

    <noscript> <img alt="Map of Russia, Ekaterinburg, Mira 32" src="http://maps.google.com/maps/api/staticmap?center=,&zoom=16&markers=,&size=300x400&sensor=false"> </noscript>

    </div>

    <!-- Map creation script --> <script type="text/javascript"> function initialize_map_1() { var latlng = new google.maps.LatLng(, ); var mapElem = document.getElementById("map-canvas-1");

    var mapOptions = { zoom: 16, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP };

    var map = new google.maps.Map(mapElem, mapOptions);

    var marker = new google.maps.Marker({ position: latlng, map: map, title: "Russia, Ekaterinburg, Mira 32" });

    }

    initialize the map after page loading google.maps.event.addDomListener(window, 'load', initialize_map_1);

    </script>

    </body> </html>

  6. Mikhail Korobov repo owner

    Geocoder wasn't able to get the coordinates for some reason. Try deleting the Address instance in your admin and trying again (and maybe setting the EASY_MAPS_GOOGLE_KEY option).

    Unfortunately geocoding error debugging is not supported well in django-easy-maps now (it only sets a 'geocode_error' flag on Address instance, the reason gets lost), patches that will improve this are welcome.

  7. Anonymous

    You mean I should delete the address instance through my admin dashboard? I've set the Google map API key. What other solution do you know about? Thanks big bro. You rock!

  8. Anonymous

    I have the same problem with the same code, lat and long return nothing. I don't have an address instance in the admin dashboard ( if I understand you well )

  9. Anonymous

    I have checked geopy, they recommend using resource="map/geo" instead of "map". But Geopy is working anyway.

    I got it: "Russia, Ekaterinburg, Mira 32" as 2 solution according to geopy. May be I should render this kind of error on my template.

    Plus I didn't wrote the address instance in the admin dashboard.

    ( Love this app by the way )

  10. Dmytro Buts

    Yes, it returns multiple solutions, and geocode raises ValueError. For me worked changing:

    self.computed_address, (self.latitude, self.longitude,) = g.geocode(address)
    

    to

    self.computed_address, (self.latitude, self.longitude,) = g.geocode(address, exactly_one=False)[0]
    

    in models.py

  11. Log in to comment