Select to view content in your preferred language

Creating a featurelayer from an array of locations

989
2
Jump to solution
01-21-2022 11:49 AM
Labels (1)
BushraSyed1
Emerging Contributor

Hello!

I was wondering if it would be possible to turn a 2d array of latitude and longitude into a featurelayer using esri leaflet? Would this be difficult to accomplish? This is what the data looks like:

 

var data = [
        { "latitude": 59.441193, "longitude": 24.729494 },
        { "latitude": 59.432365, "longitude": 24.742992 },
        { "latitude": 59.431602, "longitude": 24.757563 },
        { "latitude": 59.437843, "longitude": 24.765759 },
        { "latitude": 59.439644, "longitude": 24.779041 },
        { "latitude": 59.434776, "longitude": 24.756681 }
    ];

 

 

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
by Anonymous User
Not applicable

LeafletJS is pretty open-ended here with a few ways you could accomplish this. But with the esri-leaflet plugin there is no concept of a "client-side-only" FeatureLayer (but there is in the ArcGIS API for JavaScript).

Back to LeafletJS itself, you can use layer types such as `Marker`, `Circle`, or `CircleMarker` with each of your objects in your data array.

https://leafletjs.com/reference.html

View solution in original post

0 Kudos
2 Replies
JayJohnson2
Frequent Contributor

You could use Add XY Coordinates in ArcMap to convert the table of coordinates to points, and then share the result as a map.  Leaflet can be used to publish it, but isn't required.

0 Kudos
by Anonymous User
Not applicable

LeafletJS is pretty open-ended here with a few ways you could accomplish this. But with the esri-leaflet plugin there is no concept of a "client-side-only" FeatureLayer (but there is in the ArcGIS API for JavaScript).

Back to LeafletJS itself, you can use layer types such as `Marker`, `Circle`, or `CircleMarker` with each of your objects in your data array.

https://leafletjs.com/reference.html

0 Kudos