react-native-clusterer icon indicating copy to clipboard operation
react-native-clusterer copied to clipboard

points in useClusterer are empty

Open Vin-Xi opened this issue 4 years ago • 5 comments

Issue

No markers were being rendered on my map. So I logged the points returned by useClusterer hook, it returned an empty array. So I tried using getRandomData from example, even that returned an empty array.

I have tried going into the library and have figured out by logging at various places that, this.cppInstance.getCluster is returning an empty array. There seems to be an issue from there or maybe I am not meeting some requirements for data.

Code

Click to expand
const {width, height} = Dimensions.get('window');
const MAP_DIM = {width, height};


const Map = () => {
  
  const [region, setRegion] = useState({
    latitude: 25.276987,
    longitude: 55.296249,
    latitudeDelta: 0.0922,
    longitudeDelta: 0.0421,
  });

  const [points,supercluster] = useClusterer(
    gen,
    MAP_DIM,
    region
  )
  ......

//MOCKDATA


export const gen = Array.from(new Array(10), (_, index) => (
  {
    type: "Feature" as "Feature",
    properties: {
      title: `${index}`,
      id: index,
    },
    geometry: {
      type: 'Point' as "Point",
      coordinates: [baseLatitude - Math.random(), baseLongitude + Math.random()]
    },
  }
));

Environment

Click to expand

Package version:

react-native:0.70 react-native-clusterer: 1.2.2, react-native-maps: 1.3.2,

System: OS: Windows 10 10.0.19044 CPU: (8) x64 Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz Memory: 14.69 GB / 31.88 GB Binaries: Node: 16.15.1 - C:\Program Files\nodejs\node.EXE Yarn: Not Found npm: 8.11.0 - C:\Program Files\nodejs\npm.CMD Watchman: Not Found SDKs: Android SDK: Not Found Windows SDK: Not Found IDEs: Android Studio: AI-212.5712.43.2112.8609683 Visual Studio: Not Found Languages: Java: 18.0.1.1 - C:\Program Files\Common Files\Oracle\Java\javapath\javac.EXE npmPackages: @react-native-community/cli: Not Found react: 18.1.0 => 18.1.0 react-native: 0.70.0 => 0.70.0 react-native-windows: Not Found npmGlobalPackages: react-native: Not Found

Vin-Xi avatar Oct 24 '22 08:10 Vin-Xi

@Vin-Xi Have you figured out what the problem was?

vytautasvargonas avatar Apr 04 '23 09:04 vytautasvargonas

No, seeing how this issue is stale. I would say you are better off using some other library for clustering

Vin-Xi avatar Apr 09 '23 19:04 Vin-Xi

@Vin-Xi what did you use?

endrits079 avatar Aug 21 '23 21:08 endrits079

Any luck?

riddy6421 avatar Dec 31 '23 00:12 riddy6421

Seems like you inverted the coordinates - [lat, lng] instead of the correct [lng, lat]

JiriHoffmann avatar Mar 25 '24 00:03 JiriHoffmann