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

Unable to draw lines based on the coordinates that were returned by the directions API #389

Open
ejlocop opened this issue Sep 17, 2020 · 0 comments

Comments

@ejlocop
Copy link

ejlocop commented Sep 17, 2020

It looks like addSource and addLayer to draw directions/route on the map isn't working.

below are my codes

await mapBox.addSource('route-line', {
		type: 'geojson',
		url: 'mapbox://mapbox.satellite',
		data: {
			type: "Feature",
			geometry: {
				type: "LineString",
				coordinates
			}
		}
	})

return await mapBox.addLayer({
		id: 'line',
		type: 'line',
		source: 'route-line',
		layout: {
			'line-cap': 'round',
			'line-join': 'round'
		},
		paint: {
			'line-color': '#ff0000',
			'line-width': 5,
			'line-opacity': 1
		}
	})

The coordinates are..

coordinates = [
          [
            120.966606,
            14.649952
          ],
          [
            120.966782,
            14.649673
          ],
          [
            120.966011,
            14.6493
          ],
          [
            120.966278,
            14.648105
          ],
          [
            120.96524,
            14.647702
          ],
          [
            120.962242,
            14.645054
          ],
          [
            120.962372,
            14.644881
          ],
          [
            120.959068,
            14.642092
          ],
          [
            120.954628,
            14.646876
          ],
          [
            120.952171,
            14.644948
          ],
          [
            120.950279,
            14.647659
          ],
          [
            120.951324,
            14.648144
          ],
          [
            120.95031,
            14.651459
          ],
          [
            120.944794,
            14.66421
          ],
          [
            120.944504,
            14.666482
          ],
          [
            120.942108,
            14.669816
          ],
          [
            120.940193,
            14.67138
          ],
          [
            120.935692,
            14.672931
          ],
          [
            120.936005,
            14.673723
          ],
          [
            120.936401,
            14.673439
          ]
        ],

plugin version: 5.0.1
nativescript-vue: ^2.8.1
nativescript: 6.8.0

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

1 participant