Giter Club home page Giter Club logo

Comments (7)

toepoke avatar toepoke commented on August 16, 2024

Hi,

If I understand you correctly you want to add your own places when the map first loads. In addition you want a "geo located" place to be shown as well.

This was something I did consider at the time and decided against supporting it. Simple reason being you don't know where the user is based. So you could have your places located in the UK, but the user is located in Australia. In this scenario the user wouldn't see the places on the map, or at the very least it would look wrong.

In addition mapsed would have to wait until the user allowed geo location on their browser, during which time the DIV for the map would be empty, and not a particularly nice experience.

However I can understand why you'd want to do this, and indeed others may wish to do the same.

To this end I've added an example of how to accomplish this by doing the geo lookup in your own code, and then adding it as a place. You can see this in action at:

http://mapsed.apphb.com/issues/001.html

And the code has been added to the github repository here:

https://github.com/toepoke/mapsed/tree/master/issues

Hope this helps.

from mapsed.

sebababi avatar sebababi commented on August 16, 2024

Hi Toepoke,

I have to say this is the best code I've seen that searches everything: "pizza", "restaurants", "a restaurant name", "something near a location", ... wow.

What i want to do is the same as in this link, but with your code:

http://gmaps-samples-v3.googlecode.com/svn/trunk/places/places-search.html

And I want to GeoLocate the user, and then show them the businesses around him/her with google Places API, like in your example 5. With findGeoOnLoad: true (that's easy) but the marker of where you are, uuuhhmm ;o)

I've been trying to implement your 001.js code, but I don't understand in which moment you push the _geoPlace var to the map.

Also, I'm working inside a div using your 05-search-for-places-example.js, and now it's showing in fullScreen even if I removed all the // fullWindowExample();

I removed this line: _places.push(geoPlace); and changed it for _geoPlace.push(geoPlace);

            //_places.push(geoPlace);
            _geoPlace.push(geoPlace);
            // and show the map
            // fullWindowExample();
        },
        function (err) {
            // user probably denied us geo access
            alert("Sorry couldn't find you!");
        }
    );
}

$("#search-for-places").mapsed({});
});

Thanks
Sebastian

from mapsed.

toepoke avatar toepoke commented on August 16, 2024

I think what you're after is the geoSearch setting. This was missing from the documentation (https://github.com/toepoke/mapsed#geosearch-string).

I've also tweaked mapsed.js so it will display your custom places when the map is first loaded, so you'll need to get the latest version.

Finally I've updated the 001.htm and 001.js files so you can see how to use the geoSearch parameter.

Hope this helps.

from mapsed.

sebababi avatar sebababi commented on August 16, 2024

Thanks Toepoke, that worked perfectly.

The only thing is that I can't put a different icon in the GeoLocated Marker.

var geoPlace = {
autoShow: true,
name: "Here I am!",
icon: 'http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=⊕|ff0099|000000|',
lat: geoPos.coords.latitude,
lng: geoPos.coords.longitude

this just places the same icon that I choose in the search places results.

any ideas ?

from mapsed.

toepoke avatar toepoke commented on August 16, 2024

Hi,

There's no "icon" property on the place definition. The getMarkerImage callback is used to define what icon is used.

I've updated the 001 html and js to illustrate. You'll need to get latest of mapsed.js too.

Hope this helps.

from mapsed.

sebababi avatar sebababi commented on August 16, 2024

Hi Toepoke,

I found the problem, I had placed the geolocation in both .js files,

sorry about that,

thanks
Sebastian

from mapsed.

toepoke avatar toepoke commented on August 16, 2024

Glad you're sorted :)

from mapsed.

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.