How to change the color of GeoJSON layer?Leaflet geoJSON contextmenuHow to select GeoJSON vector feature in Leaflet?Custom marker/icon based on attribute data in leaflet/geojsonHow to change the style of a vector layer on a button clickLeaflet popup options with geoJSON dataLeaflet/GeoJSON - Changing the default blue marker to other .png filesLeaflet: Change displayed column on clickMarkerCluster don't work with geojson layer in leafletsetting the style of each leaflet featureChange style of GeoJSON circle marker by feature properties

How do I exit BASH while loop using modulus operator?

How to install cross-compiler on Ubuntu 18.04?

Why was Sir Cadogan fired?

What is the difference between 'contrib' and 'non-free' packages repositories?

Blending or harmonizing

Did 'Cinema Songs' exist during Hiranyakshipu's time?

My singleton can be called multiple times

How to travel to Japan while expressing milk?

Unlock My Phone! February 2018

Placement of More Information/Help Icon button for Radio Buttons

How could sorcerers who are able to produce/manipulate almost all forms of energy communicate over large distances?

Is it possible to map the firing of neurons in the human brain so as to stimulate artificial memories in someone else?

Why do I get negative height?

What is the opposite of "eschatology"?

Are British MPs missing the point, with these 'Indicative Votes'?

In Bayesian inference, why are some terms dropped from the posterior predictive?

Does Dispel Magic work on Tiny Hut?

How to show a landlord what we have in savings?

How can I deal with my CEO asking me to hire someone with a higher salary than me, a co-founder?

Can compressed videos be decoded back to their uncompresed original format?

Pattern for multiple renderings calling same service

Mathematica command that allows it to read my intentions

How can a day be of 24 hours?

Check if a point is right or left of another one in TikZ



How to change the color of GeoJSON layer?


Leaflet geoJSON contextmenuHow to select GeoJSON vector feature in Leaflet?Custom marker/icon based on attribute data in leaflet/geojsonHow to change the style of a vector layer on a button clickLeaflet popup options with geoJSON dataLeaflet/GeoJSON - Changing the default blue marker to other .png filesLeaflet: Change displayed column on clickMarkerCluster don't work with geojson layer in leafletsetting the style of each leaflet featureChange style of GeoJSON circle marker by feature properties













0















I want to show my road network in red color. How can I change this default color of the road network. Where should I attach style property?



var roadNetwork = new L.LayerGroup();
$.getJSON("% url 'road_dataset' %", function (data)
var geojson = L.geoJson(data,
onEachFeature: function (feature, layer)
layer.bindPopup(feature.properties.road_name);

);
geojson.addTo(roadNetwork);
);









share|improve this question









New contributor




Tekson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • please you should have a look to the official doc of leaflet then if you still have problem precise your problem leafletjs.com/examples/geojson and I don't understand why it's link to jquery

    – Hugo Roussaffa - GeoDatup
    2 days ago












  • Yes i already check this documentation. But i have no idea where i can insert the style function in jquery. For showing the data from database in geodjango i used jquery.

    – Tekson
    2 days ago















0















I want to show my road network in red color. How can I change this default color of the road network. Where should I attach style property?



var roadNetwork = new L.LayerGroup();
$.getJSON("% url 'road_dataset' %", function (data)
var geojson = L.geoJson(data,
onEachFeature: function (feature, layer)
layer.bindPopup(feature.properties.road_name);

);
geojson.addTo(roadNetwork);
);









share|improve this question









New contributor




Tekson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • please you should have a look to the official doc of leaflet then if you still have problem precise your problem leafletjs.com/examples/geojson and I don't understand why it's link to jquery

    – Hugo Roussaffa - GeoDatup
    2 days ago












  • Yes i already check this documentation. But i have no idea where i can insert the style function in jquery. For showing the data from database in geodjango i used jquery.

    – Tekson
    2 days ago













0












0








0








I want to show my road network in red color. How can I change this default color of the road network. Where should I attach style property?



var roadNetwork = new L.LayerGroup();
$.getJSON("% url 'road_dataset' %", function (data)
var geojson = L.geoJson(data,
onEachFeature: function (feature, layer)
layer.bindPopup(feature.properties.road_name);

);
geojson.addTo(roadNetwork);
);









share|improve this question









New contributor




Tekson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












I want to show my road network in red color. How can I change this default color of the road network. Where should I attach style property?



var roadNetwork = new L.LayerGroup();
$.getJSON("% url 'road_dataset' %", function (data)
var geojson = L.geoJson(data,
onEachFeature: function (feature, layer)
layer.bindPopup(feature.properties.road_name);

);
geojson.addTo(roadNetwork);
);






leaflet geojson style






share|improve this question









New contributor




Tekson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Tekson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 2 days ago









Vince

14.8k32849




14.8k32849






New contributor




Tekson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 2 days ago









TeksonTekson

52




52




New contributor




Tekson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Tekson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Tekson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • please you should have a look to the official doc of leaflet then if you still have problem precise your problem leafletjs.com/examples/geojson and I don't understand why it's link to jquery

    – Hugo Roussaffa - GeoDatup
    2 days ago












  • Yes i already check this documentation. But i have no idea where i can insert the style function in jquery. For showing the data from database in geodjango i used jquery.

    – Tekson
    2 days ago

















  • please you should have a look to the official doc of leaflet then if you still have problem precise your problem leafletjs.com/examples/geojson and I don't understand why it's link to jquery

    – Hugo Roussaffa - GeoDatup
    2 days ago












  • Yes i already check this documentation. But i have no idea where i can insert the style function in jquery. For showing the data from database in geodjango i used jquery.

    – Tekson
    2 days ago
















please you should have a look to the official doc of leaflet then if you still have problem precise your problem leafletjs.com/examples/geojson and I don't understand why it's link to jquery

– Hugo Roussaffa - GeoDatup
2 days ago






please you should have a look to the official doc of leaflet then if you still have problem precise your problem leafletjs.com/examples/geojson and I don't understand why it's link to jquery

– Hugo Roussaffa - GeoDatup
2 days ago














Yes i already check this documentation. But i have no idea where i can insert the style function in jquery. For showing the data from database in geodjango i used jquery.

– Tekson
2 days ago





Yes i already check this documentation. But i have no idea where i can insert the style function in jquery. For showing the data from database in geodjango i used jquery.

– Tekson
2 days ago










1 Answer
1






active

oldest

votes


















2














You don't use jquery for this, jquery is a library for interacting with the DOM. You just have to define a style object and attach it to your layer, as seen in the documentation:



var roadNetwork = new L.LayerGroup();

var myStyle = // Define your style object
"color": "#ff0000"
;

$.getJSON("% url 'road_dataset' %", function (data)
var geojson = L.geoJson(data,

style: myStyle, // Assign the style object to the "style" property of the layer

onEachFeature: function (feature, layer)
layer.bindPopup(feature.properties.road_name);

);
geojson.addTo(roadNetwork);
);





share|improve this answer























  • Thank you very much!!

    – Tekson
    2 days ago











Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "79"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);






Tekson is a new contributor. Be nice, and check out our Code of Conduct.









draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f317262%2fhow-to-change-the-color-of-geojson-layer%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









2














You don't use jquery for this, jquery is a library for interacting with the DOM. You just have to define a style object and attach it to your layer, as seen in the documentation:



var roadNetwork = new L.LayerGroup();

var myStyle = // Define your style object
"color": "#ff0000"
;

$.getJSON("% url 'road_dataset' %", function (data)
var geojson = L.geoJson(data,

style: myStyle, // Assign the style object to the "style" property of the layer

onEachFeature: function (feature, layer)
layer.bindPopup(feature.properties.road_name);

);
geojson.addTo(roadNetwork);
);





share|improve this answer























  • Thank you very much!!

    – Tekson
    2 days ago















2














You don't use jquery for this, jquery is a library for interacting with the DOM. You just have to define a style object and attach it to your layer, as seen in the documentation:



var roadNetwork = new L.LayerGroup();

var myStyle = // Define your style object
"color": "#ff0000"
;

$.getJSON("% url 'road_dataset' %", function (data)
var geojson = L.geoJson(data,

style: myStyle, // Assign the style object to the "style" property of the layer

onEachFeature: function (feature, layer)
layer.bindPopup(feature.properties.road_name);

);
geojson.addTo(roadNetwork);
);





share|improve this answer























  • Thank you very much!!

    – Tekson
    2 days ago













2












2








2







You don't use jquery for this, jquery is a library for interacting with the DOM. You just have to define a style object and attach it to your layer, as seen in the documentation:



var roadNetwork = new L.LayerGroup();

var myStyle = // Define your style object
"color": "#ff0000"
;

$.getJSON("% url 'road_dataset' %", function (data)
var geojson = L.geoJson(data,

style: myStyle, // Assign the style object to the "style" property of the layer

onEachFeature: function (feature, layer)
layer.bindPopup(feature.properties.road_name);

);
geojson.addTo(roadNetwork);
);





share|improve this answer













You don't use jquery for this, jquery is a library for interacting with the DOM. You just have to define a style object and attach it to your layer, as seen in the documentation:



var roadNetwork = new L.LayerGroup();

var myStyle = // Define your style object
"color": "#ff0000"
;

$.getJSON("% url 'road_dataset' %", function (data)
var geojson = L.geoJson(data,

style: myStyle, // Assign the style object to the "style" property of the layer

onEachFeature: function (feature, layer)
layer.bindPopup(feature.properties.road_name);

);
geojson.addTo(roadNetwork);
);






share|improve this answer












share|improve this answer



share|improve this answer










answered 2 days ago









wfgeowfgeo

1,528518




1,528518












  • Thank you very much!!

    – Tekson
    2 days ago

















  • Thank you very much!!

    – Tekson
    2 days ago
















Thank you very much!!

– Tekson
2 days ago





Thank you very much!!

– Tekson
2 days ago










Tekson is a new contributor. Be nice, and check out our Code of Conduct.









draft saved

draft discarded


















Tekson is a new contributor. Be nice, and check out our Code of Conduct.












Tekson is a new contributor. Be nice, and check out our Code of Conduct.











Tekson is a new contributor. Be nice, and check out our Code of Conduct.














Thanks for contributing an answer to Geographic Information Systems Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid …


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f317262%2fhow-to-change-the-color-of-geojson-layer%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Magento 1.9 observer on only new product added ( no updated product )Admin Create New Order ObserverObserver checkout_cart_product_add_after get product quantity in cartHow can I differentiate between product creation and saving existing products?How to get the original price Product SaveBeforeMagento Observer for Admin Sales order Address updateHow do i get quantity in a product_save_after event observer magento2?Using observer event to get updated customer infoSave product observer - detect availabilityEvent not triggered when new product added in admin : Magento 2magento 1.9 observer on quantity product change

Does an object always see its latest internal state irrespective of thread? The 2019 Stack Overflow Developer Survey Results Are InDoes a finally block always get executed in Java?Java: serial thread confinement questionJava difference between fixed threadpool and scheduled threadpoolJackrabbit and concurrent modificationHow to stop a Runnable scheduled for repeated execution after a certain number of executionsMultiple threads accessing inner classHow can a loop be completed by two thread? say loop from count=1 to count=4 by ist thread and count =5 to 8 by 2nd thread?If I keep a reference to a Runnable, when does the Thread it ran on get released?How to stop a schedule ScheduledExecutorServiceHow to implement a singleThreadedScheduledExcecutor in wildfly

Adding contour labels to SpatialLinesDataFrame or sf object? The Next CEO of Stack OverflowTearing of SpatialLinesDataFrame and problem with gClip functionAutomatically adjusting map labelsExtracting data.frame from simple features object in RR convert sf object back to SpatialPolygonsDataFrameSimplify polygons of sf objectlines of a SpatialLinesDataFrame corresponding to pointsCropping sf object in R?Pattern matching with grepl on SpatialPolygonsDataFrame object in RHow to create and empty SpatialLinesDataFrame in RWarning message in raster::rotate(): “this does not look like an appropriate object for this function”