question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Impossible to add a Geojson layer

See original GitHub issue

Hello

I’ve been using your library to try to display a map on a nativescript/angular app and i ran into an issue.

I created my map, no problem there, and then tried to add a Geojson layer on top of that. I used the addLayer method like described in the documentation and kept running into an error “No map has been loaded”.

After multiple checks on my code, i investigated the source code of the lib to find more info about what i did wrong and found that :

The addLayer method calls the addLineLayer because in my case i want to draw lines (https://github.com/Yermo/nativescript-mapbox/blob/master/src/mapbox.android.ts#L3121)

addLineLayers calls the addSource to add the layer source (https://github.com/Yermo/nativescript-mapbox/blob/master/src/mapbox.android.ts#L3262)

As you can see, it calls it with 2 parameters.

this.addSource( sourceId, style.source );

In addSource (https://github.com/Yermo/nativescript-mapbox/blob/master/src/mapbox.android.ts#L2958) we have a 3rd optional parameter called nativeMap.

the first thing the method does is check that parameter and return an error if it’s not set.

const theMap = nativeMap; if (!theMap) { reject("No map has been loaded"); return; }

So i have an error. It’s logical but unexpected.

Is this an error or am i using a deprecated method to add a layer ?

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
Yermocommented, Jun 12, 2020

I think I have this working now.

Please checkout branch issue_367_geojsonsource.

Rebuild the plugin and demo-angular app using:

cd src
npm run build.debug
cd ../demo-angular
tns run <platform>

I’ve added a test-source page to the demo angular app.

Let me know if it works for you.

1reaction
Yermocommented, Jul 7, 2020

Yes. I plan to do another major pass through the plugin in a few weeks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to create GeoJSON layer - Stack Overflow
I'm developing an app in angular that use leaflet map to show some layers and I'm trying to use GeoJSON, but I'm unable...
Read more >
Can't load geoJSON files in Leaflet layer control
open geoJSON in a text-editor and put following code in front of geoJSON code: ... var zabudowaJSON_l = L.geoJson(zabudowaJSON).addTo(map);.
Read more >
Uploading a GeoJSON Layer File
To add a GeoJSON file from your computer, click on the Layer Control button and select Add GeoJSON as shown below. For multiple...
Read more >
GeoJSONLayer | ArcGIS Maps SDK for JavaScript 4.25
You can also create a GeoJSONLayer from in memory geojson data by passing a blob url to the url ... See the table...
Read more >
Chapter 7 GeoJSON | Introduction to Web Mapping
On the other hand, it is a fully-featured vector layer format, ... and how we can add GeoJSON layers on a Leaflet map...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found