Comments (7)
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.
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.
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.
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.
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.
Hi Toepoke,
I found the problem, I had placed the geolocation in both .js files,
sorry about that,
thanks
Sebastian
from mapsed.
Glad you're sorted :)
from mapsed.
Related Issues (20)
- Search with GEO co-ordinates no longer working
- Depreciation of "Reference" field in Google Places API HOT 1
- Upgrade jQuery version
- Cannot edit a "custom" place once it's been added
- Full example can be improved
- When "showOnLoad" and "initSearch" are used the "custom" places don't load
- Rendering of mapsed buttons are often covered by google icons
- Google+ is no longer a thing ...
- When adding a new location with the "+" icon nothing happens
- Allow "template" customisation "hooks"
- Clicking on "custom" places opens in "edit" mode
- Saving a "new" marker doesn't change the marker icon
- Ability to add "markers" to the current map boundary
- Marker pagination
- Google Marker API depreciation
- onMapMoved should be an async operation
- onAdd needs a separate save event from onSave
- canDelete model property missing
- Change marker clicks to be a toggle
- make link tittle on example 1 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mapsed.