Thereare many ways you could do this by iterating over either the original GeoJSON or the resulting L.GeoJson layer to produce a polyline geometry. Here is one simple function that will turn a L.geoJson layer of points into an array of coordinates that can be passed to L.polyline:
To be rigorous, you have to use your data when the list of points is still an array (and assuming the array order is the order of line connections you want to get). Which means you have to work on your GeoJSON data directly.
The GeoJSON data will be converted by Leaflet into vectors for polylines, polygons, etc., and markers for point features.Please refer to Leaflet tutorial and reference.
When you want to specify how Leaflet should style the vectors, you should indeed make up an object that holds path options (like your style variable on first line), but you should give it as the style option of your L.geoJson layer, not inside an icon.
When you want to specify how Leaflet should style the markers, you can indeed set a specific icon, which will be applicable only to point features. You should better use the pointToLayer option, as the code will be really applied only on points, instead of trying to apply it to vectors (which do not have a method setIcon for example).
As pointed out in the comments, whenever you seek for help from other people, you would make their task easier (hence you would get better and faster support) if you take the time to properly state your issue, with description / screenshots of what is going wrong and post some clean code. A very good practice for client side code is to reproduce the issue on jsFiddle for example.
Pans the map the minimum amount to make the latlng visible. Usepadding options to fit the display to more restricted bounds.If latlng is already within the (optionally padded) display bounds,the map will not be panned.
Tries to locate the user using the Geolocation API, firing a locationfoundevent with location data on success or a locationerror event on failure,and optionally sets the map view to the user's location with respect todetection accuracy (or to the world view if geolocation failed).Note that, if your page doesn't use HTTPS, this method will fail inmodern browsers (Chrome 50 and newer)See Locate options for more details.
Returns the maximum zoom level on which the given bounds fit to the mapview in its entirety. If inside (optional) is set to true, the methodinstead returns the minimum zoom level on which the map view fits intothe given bounds in its entirety.
Projects a geographical coordinate LatLng according to the projectionof the map's CRS, then scales it according to zoom and the CRS'sTransformation. The result is pixel coordinate relative tothe CRS origin.
Returns a LatLng where lat and lng has been wrapped according to themap's CRS's wrapLat and wrapLng properties, if they are outside theCRS's bounds.By default this means longitude is wrapped around the dateline so itsvalue is between -180 and +180 degrees.
Returns a LatLngBounds with the same size as the given one, ensuring thatits center is within the CRS's bounds.By default this means the center longitude is wrapped around the dateline so itsvalue is between -180 and +180 degrees, and the majority of the boundsoverlaps the CRS's bounds.
Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
Binds a popup to the layer with the passed content and sets up thenecessary event listeners. If a Function is passed it will receivethe layer as the first argument and should return a String or HTMLElement.
Binds a tooltip to the layer with the passed content and sets up thenecessary event listeners. If a Function is passed it will receivethe layer as the first argument and should return a String or HTMLElement.
Used to open popups in certain places of the map. Use Map.openPopup toopen popups while making sure that only one popup is open at one time(recommended for usability), or use Map.addLayer to open as many as you want.
3a8082e126