Skip to main content
corrected typos
Source Link
nmtoken
  • 13.6k
  • 5
  • 38
  • 89

Openlayers Vectorlayer OpenLayers Vector layer projection

I use OpenlayersOpenLayers to display an OpenStreetMap map and on top of that I want to add a vector layer with features. But it seems that I have a problem with the projection of the vector layer or the features which all use GPS data.

The features are only correctly applied to the map if the map is maximally zoomed. As soon as I zoom out the features move from the original point on the map and if I zoom out the map long enough, they form a circle.

Here is how I set the features:

var iconFeature = new ol.Feature({
geometry: new ol.geom.Point(ol.proj.transform([<somelonvalue>, <somelanvalue>], 'EPSG:4326', 'EPSG:3857')),
popuptext: '<sometext>',
});
        
iconFeature.setId('$featureID');

And here is how I created the vector layer:

vectorSource = new ol.source.Vector({
features: iconFeatures
});

var vectorLayer = new ol.layer.Vector({
source: vectorSource
});

map.addLayer(vectorLayer);

Here is the outcome if I zoom out the map:

Here is what is my outcome if I zoom out the map.

Anybody hasI believe I did the transformation correctly.

Does anybody have a clue as to what I am doing wrong? I believe I did the transformation correctly.

Openlayers Vectorlayer projection

I use Openlayers to display an OpenStreetMap map and on top of that I want to add a vector layer with features. But it seems that I have a problem with the projection of the vector layer or the features which all use GPS data.

The features are only correctly applied to the map if the map is maximally zoomed. As soon as I zoom out the features move from the original point on the map and if I zoom out the map long enough, they form a circle.

Here is how I set the features:

var iconFeature = new ol.Feature({
geometry: new ol.geom.Point(ol.proj.transform([<somelonvalue>, <somelanvalue>], 'EPSG:4326', 'EPSG:3857')),
popuptext: '<sometext>',
});
        
iconFeature.setId('$featureID');

And here is how I created the vector layer:

vectorSource = new ol.source.Vector({
features: iconFeatures
});

var vectorLayer = new ol.layer.Vector({
source: vectorSource
});

map.addLayer(vectorLayer);

Here is the outcome if I zoom out the map:

Here is what is my outcome if I zoom out the map.

Anybody has a clue as to what I am doing wrong? I believe I did the transformation correctly.

OpenLayers Vector layer projection

I use OpenLayers to display an OpenStreetMap map and on top of that I want to add a vector layer with features. But it seems that I have a problem with the projection of the vector layer or the features which all use GPS data.

The features are only correctly applied to the map if the map is maximally zoomed. As soon as I zoom out the features move from the original point on the map and if I zoom out the map long enough, they form a circle.

Here is how I set the features:

var iconFeature = new ol.Feature({
geometry: new ol.geom.Point(ol.proj.transform([<somelonvalue>, <somelanvalue>], 'EPSG:4326', 'EPSG:3857')),
popuptext: '<sometext>',
});
        
iconFeature.setId('$featureID');

And here is how I created the vector layer:

vectorSource = new ol.source.Vector({
features: iconFeatures
});

var vectorLayer = new ol.layer.Vector({
source: vectorSource
});

map.addLayer(vectorLayer);

Here is the outcome if I zoom out the map:

Here is what is my outcome if I zoom out the map.

I believe I did the transformation correctly.

Does anybody have a clue as to what I am doing wrong?

corrected spelling, fixed grammar, improved formatting.
Source Link
whyzar
  • 12.1k
  • 23
  • 39
  • 72

I use Openlayers to display an OpenStreetMap map and on top of that I want to add a vector layer with features. But it seems that I have a problem with the projection of the vector layer or the features which all use GPS data. 

The features are only correctly applied to the map if the map is maximally zoomed. As soon as I zoom out the features move from the original point on the map and if I zoom out the map long enough, they form a circle.

Here is how I set the features:

var iconFeature = new ol.Feature({
geometry: new ol.geom.Point(ol.proj.transform([<somelonvalue>, <somelanvalue>], 'EPSG:4326', 'EPSG:3857')),
popuptext: '<sometext>',
});
        
iconFeature.setId('$featureID');

And here is how I createcreated the vector layer:

vectorSource = new ol.source.Vector({
features: iconFeatures
});

var vectorLayer = new ol.layer.Vector({
source: vectorSource
});

map.addLayer(vectorLayer);

Here is the outcome if I zoom out the map:

Here is what is my outcome if I zoom out the map.

Anybody has a clue as to what I am doing wrong? I believe I dodid the transformation correctly.

I use Openlayers to display an OpenStreetMap map and on top of that I want to add a vector layer with features. But it seems that I have a problem with the projection of the vector layer or the features which all use GPS data. The features are only correctly applied to the map if the map is maximally zoomed. As soon as I zoom out the features move from the original point on the map and if I zoom out the map long enough, they form a circle.

Here is how I set the features:

var iconFeature = new ol.Feature({
geometry: new ol.geom.Point(ol.proj.transform([<somelonvalue>, <somelanvalue>], 'EPSG:4326', 'EPSG:3857')),
popuptext: '<sometext>',
});
        
iconFeature.setId('$featureID');

And here is how I create the vector layer:

vectorSource = new ol.source.Vector({
features: iconFeatures
});

var vectorLayer = new ol.layer.Vector({
source: vectorSource
});

map.addLayer(vectorLayer);

Here is the outcome if I zoom out the map:

Here is what is my outcome if I zoom out the map.

Anybody has a clue what I am doing wrong? I believe I do the transformation correctly.

I use Openlayers to display an OpenStreetMap map and on top of that I want to add a vector layer with features. But it seems that I have a problem with the projection of the vector layer or the features which all use GPS data. 

The features are only correctly applied to the map if the map is maximally zoomed. As soon as I zoom out the features move from the original point on the map and if I zoom out the map long enough, they form a circle.

Here is how I set the features:

var iconFeature = new ol.Feature({
geometry: new ol.geom.Point(ol.proj.transform([<somelonvalue>, <somelanvalue>], 'EPSG:4326', 'EPSG:3857')),
popuptext: '<sometext>',
});
        
iconFeature.setId('$featureID');

And here is how I created the vector layer:

vectorSource = new ol.source.Vector({
features: iconFeatures
});

var vectorLayer = new ol.layer.Vector({
source: vectorSource
});

map.addLayer(vectorLayer);

Here is the outcome if I zoom out the map:

Here is what is my outcome if I zoom out the map.

Anybody has a clue as to what I am doing wrong? I believe I did the transformation correctly.

I use openlayersOpenlayers to display an openstreetmapOpenStreetMap map and on top of that I want to add a vector layer with features. But it seems that iI have a problem with the projection of the vector layer or the features which all use GPS data. The features are only correctly applied to the map if the map is maximally zoomed. As soon as I zoom out the features move from the original point on the map and if I zoom out the map long enough, they form a circle.

Here is how I set the features:

var iconFeature = new ol.Feature({
geometry: new ol.geom.Point(ol.proj.transform([<somelonvalue>, <somelanvalue>], 'EPSG:4326', 'EPSG:3857')),
popuptext: '<sometext>',
});
        
iconFeature.setId('$featureID');

And here is how I create the vector layer:

vectorSource = new ol.source.Vector({
features: iconFeatures
});

var vectorLayer = new ol.layer.Vector({
source: vectorSource
});

map.addLayer(vectorLayer);

Here is the outcome if I zoom out the map:

Here is what is my outcome if I zoom out the map.

Anybody has a clue what I am doing wrong? I believe I do the transformation correctly.

I use openlayers to display an openstreetmap map and on top of that I want to add a vector layer with features. But it seems that i have a problem with the projection of the vector layer or the features which all use GPS data. The features are only correctly applied to the map if the map is maximally zoomed. As soon as I zoom out the features move from the original point on the map and if I zoom out the map long enough, they form a circle.

Here is how I set the features:

var iconFeature = new ol.Feature({
geometry: new ol.geom.Point(ol.proj.transform([<somelonvalue>, <somelanvalue>], 'EPSG:4326', 'EPSG:3857')),
popuptext: '<sometext>',
});
        
iconFeature.setId('$featureID');

And here is how I create the vector layer:

vectorSource = new ol.source.Vector({
features: iconFeatures
});

var vectorLayer = new ol.layer.Vector({
source: vectorSource
});

map.addLayer(vectorLayer);

Here is the outcome if I zoom out the map:

Here is what is my outcome if I zoom out the map.

Anybody has a clue what I am doing wrong? I believe I do the transformation correctly.

I use Openlayers to display an OpenStreetMap map and on top of that I want to add a vector layer with features. But it seems that I have a problem with the projection of the vector layer or the features which all use GPS data. The features are only correctly applied to the map if the map is maximally zoomed. As soon as I zoom out the features move from the original point on the map and if I zoom out the map long enough, they form a circle.

Here is how I set the features:

var iconFeature = new ol.Feature({
geometry: new ol.geom.Point(ol.proj.transform([<somelonvalue>, <somelanvalue>], 'EPSG:4326', 'EPSG:3857')),
popuptext: '<sometext>',
});
        
iconFeature.setId('$featureID');

And here is how I create the vector layer:

vectorSource = new ol.source.Vector({
features: iconFeatures
});

var vectorLayer = new ol.layer.Vector({
source: vectorSource
});

map.addLayer(vectorLayer);

Here is the outcome if I zoom out the map:

Here is what is my outcome if I zoom out the map.

Anybody has a clue what I am doing wrong? I believe I do the transformation correctly.

Source Link
Benedikt
  • 53
  • 1
  • 1
  • 4
Loading