Answer the question
In order to leave comments, you need to log in
How to add a label (point, circle, polygon) in OpenLayers 3?
Maybe I'm stupid, because there is a question . But he seems to be for the second version and tried what was written there, it did not work out.
Give an example or where to read.
Now there is this option:
var lonlat = ol.proj.transform([37.6094, 55.739], 'EPSG:4326', 'EPSG:3857');
var map = new ol.Map({
target: 'osm-map',
layers: [
new ol.layer.Tile({
source: new ol.source.XYZ({
url: 'http://127.0.0.1:8080/osm_tiles/{z}/{x}/{y}.png'
})
}),
new ol.layer.Vector({
source: new ol.source.Vector({}).addFeature(
new ol.Feature({
geometry: new ol.geom.Point(lonlat),
name: 'Null Island ',
population: 4000,
rainfall: 500
})
),
style: new ol.style.Style({
image: new ol.style.Circle({
radius: 20,
fill: new ol.style.Fill({color: 'red'})
})
})
})
],
view: new ol.View({
center: lonlat,
zoom: 4
})
});
Answer the question
In order to leave comments, you need to log in
openlayers.org/en/v3.1.1/examples/icon.html
here is an example of a map marker
1. You have an array in JSON. Accordingly, config should be declared as
2. Handle the error and perhaps you will understand what's wrong.
You have an array of objects in the file, and you are trying to parse the object
var config []Config = make([]Config)
like that you need to declare
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question