[Poll / Tracking Issue]: What examples would be most helpful to add? #155
Replies: 15 comments 1 reply
-
Create an autocomplete component |
Beta Was this translation helpful? Give feedback.
-
Using the Geocoder / PlacesService and other Maps API Services |
Beta Was this translation helpful? Give feedback.
-
Creating custom controls. https://developers.google.com/maps/documentation/javascript/controls#CustomControls |
Beta Was this translation helpful? Give feedback.
-
Setting the map's viewport to contain given bounds using https://developers.google.com/maps/documentation/javascript/reference/map#Map.fitBounds. Is this possible? In my case This may be how the fit bounds example looks like: import { googleApiKey } from "~/config/constants";
import { map } from "lodash";
import { Bound } from "~/api/bounds";
import { useEffect } from "react";
import { APIProvider, useMapsLibrary, Map } from '@vis.gl/react-google-maps';
export default function VisGlMap({ bounds }: { bounds: Bound[] }) {
const center = {lat: bounds[0].latitude, lng: bounds[0].longitude };
const zoom = 12;
const mapLibrary = useMapsLibrary('maps');
useEffect(() => {
if (!mapLibrary) return;
console.log('mapLibrary', mapLibrary)
const mapBounds = mapLibrary.getBounds();
map(bounds, (bound: Bound) => {
const { latitude, longitude } = bound;
const position = new mapLibrary.LatLng(latitude, longitude);
mapBounds.extend(position);
});
mapLibrary.fitBounds(bounds);
}, [mapLibrary])
return (
<APIProvider apiKey={googleApiKey}>
<Map center={center} zoom={zoom} />
</APIProvider>
);
}; |
Beta Was this translation helpful? Give feedback.
-
@charbeltabet Shouldn't |
Beta Was this translation helpful? Give feedback.
-
Marker clustering (or should that be added as a feature request first?) |
Beta Was this translation helpful? Give feedback.
-
There is this: https://github.com/visgl/react-google-maps/blob/main/examples/marker-clustering/src/app.tsx but it is a bit clunky. |
Beta Was this translation helpful? Give feedback.
-
draw lines and polylines |
Beta Was this translation helpful? Give feedback.
-
Customizing the Marker element on the map |
Beta Was this translation helpful? Give feedback.
-
@yestoall before an example can be added for this, the feature (component) needs to be added to the library. Please comment at #105 to indicate your interest in polylines! |
Beta Was this translation helpful? Give feedback.
-
@KonstantinosVazaios What customizations would you like to see which are not already demonstrated in https://visgl.github.io/react-google-maps/examples/markers-and-infowindows ? |
Beta Was this translation helpful? Give feedback.
-
@wangela Have the ability to pass any React Component as the map marker. In other words I would like to see examples of replacing this boring red marker with a custom component, img or something like this😄 |
Beta Was this translation helpful? Give feedback.
-
Please please please please add more details on using the useAutocomplete hook, I've spent so many hours on it and it is just not working. |
Beta Was this translation helpful? Give feedback.
-
@alexander-densley sorry to hear that. We will probably remove the autocomplete hook for the 1.0 version and replace it with a sample implementation in examples until we are more clear on what kind of autocomplete hook or component we want to support for the future... See also #18 and https://visgl.github.io/react-google-maps/docs/contributing#goals-and-philosophy |
Beta Was this translation helpful? Give feedback.
-
Choropleth map |
Beta Was this translation helpful? Give feedback.
-
We could use a bunch more examples in this library. But which ones to add?
Please comment below and vote on existing comments (using 👍 or similar) for what examples should be added and we'll track that here.
Beta Was this translation helpful? Give feedback.
All reactions