Coder Social home page Coder Social logo

Not Getting It about django-easy-maps HOT 18 CLOSED

bashu avatar bashu commented on May 25, 2024
Not Getting It

from django-easy-maps.

Comments (18)

bashu avatar bashu commented on May 25, 2024

Hi skizzy,

Doesn't

{{{

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

work?

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


Original comment by: Mikhail Korobov

from django-easy-maps.

bashu avatar bashu commented on May 25, 2024

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.


Original comment by: skizzy

from django-easy-maps.

bashu avatar bashu commented on May 25, 2024

One more thing, I'm developing on windows machine through localhost:8000. :)


Original comment by: skizzy

from django-easy-maps.

bashu avatar bashu commented on May 25, 2024

What is the result html of the template rendering?


Original comment by: Mikhail Korobov

from django-easy-maps.

bashu avatar bashu commented on May 25, 2024

Just A blank Page! Nothing more, nothing less. :)


Original comment by: skizzy

from django-easy-maps.

bashu avatar bashu commented on May 25, 2024

Just a white blank Page! Nothing more, nothing less. :)


Original comment by: skizzy

from django-easy-maps.

bashu avatar bashu commented on May 25, 2024

Can you please post the result html source code here?


Original comment by: Mikhail Korobov

from django-easy-maps.

bashu avatar bashu commented on May 25, 2024

Template:

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

{% easy_map address 200 200 5 using 'easy_maps/map.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.


Original comment by: skizzy

from django-easy-maps.

bashu avatar bashu commented on May 25, 2024

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.


Original comment by: Mikhail Korobov

from django-easy-maps.

bashu avatar bashu commented on May 25, 2024
<!-- 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>

Original comment by: skizzy

from django-easy-maps.

bashu avatar bashu commented on May 25, 2024

What do you think is wrong? :)


Original comment by: skizzy

from django-easy-maps.

bashu avatar bashu commented on May 25, 2024

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.


Original comment by: Mikhail Korobov

from django-easy-maps.

bashu avatar bashu commented on May 25, 2024

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!


Original comment by: Anonymous

from django-easy-maps.

bashu avatar bashu commented on May 25, 2024

Its me skizzy. I'm commenting through mobile.


Original comment by: Anonymous

from django-easy-maps.

bashu avatar bashu commented on May 25, 2024

Oops, I missed your updates. Yes, I mean deleting the address instance through admin dashboard. Is the problem resolved?


Original comment by: Mikhail Korobov

from django-easy-maps.

bashu avatar bashu commented on May 25, 2024

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 )


Original comment by: Anonymous

from django-easy-maps.

bashu avatar bashu commented on May 25, 2024

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 )


Original comment by: Anonymous

from django-easy-maps.

bashu avatar bashu commented on May 25, 2024

Yes, it returns multiple solutions, and geocode raises ValueError.
For me worked changing:
{{{
#!python
self.computed_address, (self.latitude, self.longitude,) = g.geocode(address)
}}}
to
{{{
#!python
self.computed_address, (self.latitude, self.longitude,) = g.geocode(address, exactly_one=False)[0]
}}}
in models.py


Original comment by: Dmytro Buts

from django-easy-maps.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.