Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

location of googlelayer is not matching other layers #12

Closed
ehsan-sotoodeh opened this issue Jan 11, 2020 · 4 comments
Closed

location of googlelayer is not matching other layers #12

ehsan-sotoodeh opened this issue Jan 11, 2020 · 4 comments

Comments

@ehsan-sotoodeh
Copy link

ehsan-sotoodeh commented Jan 11, 2020

Thanks for the awesome library.
I'm using it to with two geojson layers but the location of geojson layers doesn't match the location of the google layer.

2020-01-10 16_59_07-React App

      initLayers = (inputLayers) => {
      const outputLayers = inputLayers.map(layer =>{
        switch(layer.type){
          case 'geoJson':
            return (< GeoJSON key = {layer.name} data = {layer.data } onEachFeature = { this.onEachFeatureClosure(layer.style)  } />);
          break;
          case 'googleMap':
            return(
              <ReactLeafletGoogleLayer />
            )
          break;
        }
      });
      console.log(outputLayers)
      return outputLayers;
    }


    render() {
        let layers = this.initLayers(this.props.layers);
        return (
            <Map
            style={{ height: "400px", width: "100%" }}
            zoom={5}
            center={[51.51, -0.06]}
            >

        <Circle center={[51.51, -0.06]} radius={5000} />
              {layers}
          </Map>
        )
    }
@aviklai
Copy link
Owner

aviklai commented Jan 11, 2020

@ehsan-sotoodeh Hi,

Can you create a working example of this code at https://codesandbox.io/ ?
And what code does the function onEachFeatureClosure contain?

@ehsan-sotoodeh
Copy link
Author

ehsan-sotoodeh commented Jan 12, 2020

https://codesandbox.io/s/tender-brahmagupta-mpkc5
onEachFeatureClosure adds style

@aviklai
Copy link
Owner

aviklai commented Jan 12, 2020

@ehsan-sotoodeh It seems to be a bug in leaflet.gridlayer.googlemutant library:
https://gitlab.com/IvanSanchez/Leaflet.GridLayer.GoogleMutant/issues/44

I checked the proposed solution and it works (adding text-align):

.leaflet-tile {
	text-align:left !important;
}

https://codesandbox.io/s/elegant-waterfall-edy2n

@ehsan-sotoodeh
Copy link
Author

It worked!
Thank you so much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants