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

[iOS] Google Maps Custom Tile Support #770

Merged
merged 1 commit into from
Nov 11, 2016

Conversation

nitaliano
Copy link
Contributor

@nitaliano nitaliano commented Nov 6, 2016

  • Added support for custom tiles with googles maps on iOS
  • Updated current example

@nitaliano nitaliano force-pushed the google-ios-tilelayers branch 2 times, most recently from 07f813a to 397c2e4 Compare November 6, 2016 21:39
@nitaliano
Copy link
Contributor Author

I also added subdomain support in this branch for Android and iOS(google maps and mapkit) can combine that with this one if there are no objections nitaliano/react-native-maps@google-ios-tilelayers...unboundfire:google-ios-tile-subdomains

@gilbox
Copy link
Contributor

gilbox commented Nov 10, 2016

@unboundfire any idea why this isn't working for me? I don't get any errors, but it's blank...

image

@nitaliano
Copy link
Contributor Author

@gilbox just did a fresh install and I'm seeing this

screen shot 2016-11-10 at 12 33 08 pm

can you try on a clean install?

You can also place a breakpoint here to see if it is generating the correct url

@nitaliano nitaliano force-pushed the google-ios-tilelayers branch from 397c2e4 to 5ecca7b Compare November 10, 2016 20:59
@gilbox gilbox merged commit 8e78aa3 into react-native-maps:master Nov 11, 2016
@gilbox
Copy link
Contributor

gilbox commented Nov 11, 2016

Thanks @unboundfire ( ◠‿◠ )

timxyz pushed a commit to 3sidedcube/react-native-maps that referenced this pull request Nov 22, 2016
* commit '3d28a7d9fd005d59219668cf61177fe574170b84': (24 commits)
  examples-setup.md: update android instructions (react-native-maps#743)
  add example for overlay overpress and docs
  iOS google maps custom tile support (react-native-maps#770)
  [Docs] Fix capitalisation of Xcode and CocoaPods (react-native-maps#749)
  Implements animateToRegion to Google Maps iOS (react-native-maps#779)
  [RN][iOS][google] Set region only when view has width&height - Fix type issue in AIRMapManager - Setup Gemfile in example/ios dir to avoid problems with different versions of cocoapods - Update examples-setup.md to use bundler - Change MapView so that we only set the native region prop when there is a width and height. GoogleMaps iOS requires the width and height to properly calculate the map zoom level.
  updates
  [marker flicker]  Fix flicker of map pins on state change (react-native-maps#728)
  add onPress for polygons and polylines on iOS and Android
  Use latest Google Play Services (react-native-maps#731)
  Update installation.md (react-native-maps#742)
  Add latest patch releases to the changelog (react-native-maps#752)
  [ios][google] implement fitToSuppliedMarkers and fitToCoordinates (react-native-maps#750)
  If we've disabled scrolling within the map, then don't capture the touch events (react-native-maps#664)
  Fix dynamic imageSrc removal, fix flicker in react-native-maps#738  (react-native-maps#737)
  Fix Anchor point on Google Maps iOS
  Added ios google maps circle support
  Added google map type only check
  Fixed typo in google maps podspec
  Added ios google maps polygon, polyline, maptype support
  ...
Exilz pushed a commit to archriss/react-native-maps that referenced this pull request Dec 9, 2016
@shenst1
Copy link

shenst1 commented Jun 9, 2017

@unboundfire I am seeing the same problem as gilbox where i'm just getting the beige screen overtop of the map that I used to see. Did you add support for GoogleMaps because you had to, or should it work for Apple maps on iOS too. Are Maptiles formatted in a certain way to work with a specific provider? I used Maptiler and am trying to add the tiles locally for better performance. Haven't seen any examples of that but I assume it is possible.

            style={{ flex: 1, width: Dimensions.get('window').width }}
            initialRegion={{
              latitude: 47.177314,
              longitude: -122.304190,
              latitudeDelta: 0.008882,
              longitudeDelta: 0.014682
            }}
          >
            <MapView.UrlTile
              urlTemplate= "../../assets/images/maptiles/{z}/{x}/{y}.png"
              zIndex={-1}
            />
          </MapView>

I switched out my url for the example hosted one and I still get a beige screen, so I'm guessing its because of the provider or something about my installation is broken.

    "react-dom": "~15.4.2",
    "react-native": "0.42.0",
    "react-native-code-push": "^2.1.0-beta",
    "react-native-maps": "^0.15.2",```

@nitaliano
Copy link
Contributor Author

nitaliano commented Jun 9, 2017

@shenst1 map tiles can be formatted in tms which basically inverts the y axis. The current implementation in react-native-maps does not support these types of map tiles. I have gotten these types of tiles to work on my own branches.

I had a hackathon recently where I added this support to react-native-maps on one of my branches for gmaps on iOS to always have the y axis inverted. https://github.com/unboundfire/react-native-maps/tree/subdomains

Here is the diff master...unboundfire:subdomains

Look at lib/ios/AirGoogleMaps/AIRGoogleMapUrlTile.m to see the code I'm talking about.

Let me know if this helps, would be happy to send a proper PR out for this that works on both Android and iOS(gmaps, apple)

@shenst1
Copy link

shenst1 commented Jun 13, 2017

@unboundfire thanks for the response. I'm not sure if my tiles are formatted in TMS. Right now I'm having problems getting any tiles to work, starting with the demo. I created a new react-native project with only one component based off the example in the air-bnb repo. Completely isolated and with the demo i'm still getting just a beige map. If i delete the maptile, the map shows san francisco just fine.
MapTileUrl

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

Successfully merging this pull request may close these issues.

3 participants