0

Update

I would certainly hard-code the source file and change it as follows:

OpenLayers.Feature.Vector.style = {
    'default': {
        fillColor: "blue",
        ...
    },
    ...

... but this is rather a hack I would like to a avoid.


I am trying to change the fillcolor of a point shown in a django admin map.

I have already managed to change the color of a new point when I click on the map, following this solution, but I am unable to understand how I could change the color of an existing point that programmatically is inserted into the map when fetched from the database.

I have found several posts that describe how to override the StyleMap of a vector layer or how to dynamically style a map, but I do not understand how I could change the color of the dot when it is already on the map.

I attach a picture. The yellow dot is already in the database.

How can I paint it blue?

1

I have overriden the relevant settings as such:

OpenLayers.Feature.Vector.style.default.fillColor = 'blue';
OpenLayers.Feature.Vector.style.default.fillOpacity = 0.5;
OpenLayers.Feature.Vector.style.default.strokeWidth = 2;
OpenLayers.Feature.Vector.style.default.strokeColor = "red";

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.