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

[Bug]: Unable to display FeatureCollection using ShapeSource and its url prop #3718

Open
kazakovkirilliy opened this issue Dec 8, 2024 · 0 comments
Labels
bug 🪲 Something isn't working

Comments

@kazakovkirilliy
Copy link

kazakovkirilliy commented Dec 8, 2024

Mapbox Implementation

Mapbox

Mapbox Version

10.8.0

React Native Version

0.76.2

Platform

iOS, Android

@rnmapbox/maps version

10.1.33

Standalone component to reproduce

import React from "react";
import { ShapeSource, FillLayer } from "@rnmapbox/maps";


<ShapeSource
        id="countryShapeSource"
        // shape={{
        //   type: "FeatureCollection",
        //   features: [
        //     {
        //       type: "Feature",
        //       id: "ESP",
        //       properties: { name: "Spain" },
        //       geometry: {
        //         type: "Polygon",
        //         coordinates: [
        //           [
        //             [-9.034818, 41.880571],
        //             [-8.984433, 42.592775],
        //             [-9.392884, 43.026625],
        //             [-7.97819, 43.748338],
        //             [-6.754492, 43.567909],
        //             [-5.411886, 43.57424],
        //             [-4.347843, 43.403449],
        //             [-3.517532, 43.455901],
        //             [-1.901351, 43.422802],
        //             [-1.502771, 43.034014],
        //             [0.338047, 42.579546],
        //             [0.701591, 42.795734],
        //             [1.826793, 42.343385],
        //             [2.985999, 42.473015],
        //             [3.039484, 41.89212],
        //             [2.091842, 41.226089],
        //             [0.810525, 41.014732],
        //             [0.721331, 40.678318],
        //             [0.106692, 40.123934],
        //             [-0.278711, 39.309978],
        //             [0.111291, 38.738514],
        //             [-0.467124, 38.292366],
        //             [-0.683389, 37.642354],
        //             [-1.438382, 37.443064],
        //             [-2.146453, 36.674144],
        //             [-3.415781, 36.6589],
        //             [-4.368901, 36.677839],
        //             [-4.995219, 36.324708],
        //             [-5.37716, 35.94685],
        //             [-5.866432, 36.029817],
        //             [-6.236694, 36.367677],
        //             [-6.520191, 36.942913],
        //             [-7.453726, 37.097788],
        //             [-7.537105, 37.428904],
        //             [-7.166508, 37.803894],
        //             [-7.029281, 38.075764],
        //             [-7.374092, 38.373059],
        //             [-7.098037, 39.030073],
        //             [-7.498632, 39.629571],
        //             [-7.066592, 39.711892],
        //             [-7.026413, 40.184524],
        //             [-6.86402, 40.330872],
        //             [-6.851127, 41.111083],
        //             [-6.389088, 41.381815],
        //             [-6.668606, 41.883387],
        //             [-7.251309, 41.918346],
        //             [-7.422513, 41.792075],
        //             [-8.013175, 41.790886],
        //             [-8.263857, 42.280469],
        //             [-8.671946, 42.134689],
        //             [-9.034818, 41.880571],
        //           ],
        //         ],
        //       },
        //     },
        //   ],
        // }}
        url={"https://raw.githubusercontent.com/johan/world.geo.json/master/countries/ESP.geo.json"}
      >
        <FillLayer
          id="countryFillLayer"
          existing
          style={{
            fillColor: "blue",
            fillOpacity: 0.25,
          }}
        />
      </ShapeSource>

Observed behavior and steps to reproduce

I am trying to import a FeatureCollection from the URL by passing it to the ShapeSource but no success so far. When passing the content directly to the shape property, everything works as expected.

It is also not working while using a code from the Dynamic URL example

Expected behavior

FeatureCollection is shown on the map.

Notes / preliminary analysis

  • Fetching the data with fetch and setting it to shape also works
  • No errors or other logs in the console

Additional links and references

Dynamic URL example: https://github.com/rnmapbox/maps/blob/main/example/src/examples/Map/DynamicUrl.tsx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant