Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dynamic loading of vector data #171

Open
FizrukBet opened this issue Feb 18, 2015 · 8 comments
Open

dynamic loading of vector data #171

FizrukBet opened this issue Feb 18, 2015 · 8 comments

Comments

@FizrukBet
Copy link

in ol3 i'm using dinamic loading of vector data from geoserver:

var vectorLoader = function(extent, resolution, projection) {
var url = 'http://localhost:8088/geoserver/wfs?service=WFS&' +
'version=1.1.0&request=GetFeature&typename=three:build_3_3857&' +
'outputFormat=text/javascript&format_options=callback:loadFeatures' +
'&srsname=EPSG:3857&bbox=' + extent.join(',') + ',EPSG:3857';
$.ajax({
url: url,
dataType : 'jsonp'
});
};

var loadFeatures = function(response) {
var features = vectorSource.readFeatures(response);
vectorSource.addFeatures(features);
};

var vectorSource = new ol.source.ServerVector({
format: new ol.format.GeoJSON(),
loader: vectorLoader,
strategy: ol.loadingstrategy.bbox
});

var vector = new ol.layer.Vector({
source: vectorSource,
style: style
});

Сan i synchronize this data with 3d view? I want to load vector data when i changed a 3d view.

Maybe I have to use other strategy?

@gberaudo
Copy link
Member

Hi @FizrukBet, I see no reason why it would not work. As soon as a new feature is added, an event is emitted from ol3 and we create the 3D counterpart immediately.

@FizrukBet
Copy link
Author

when I move a 2D view, all ok. But I want to load data when I move a 3D view.
2D view: http://gyazo.com/df3cc114cadd8741974753f94fbb7d19
3D view: http://gyazo.com/69ebc2882dbdf4c10c7ab5ce0ca64315

I don't know how to initiate an event to load data from server by extent, when i move 3d view.

@gberaudo
Copy link
Member

gberaudo commented Feb 19, 2015 via email

@FizrukBet
Copy link
Author

"The more you are tilted, the larger the viewed area" - it's a second problem.

now, when I change 3d view vector data aren't loaded at all
http://gyazo.com/2bbd65f8e4adfd41fa06938319d8df0a
http://gyazo.com/baf120f6af2c26a7385a5ccf8a8247b9
and i don't know how i can run to load data from server

@gberaudo
Copy link
Member

gberaudo commented Feb 19, 2015 via email

@FizrukBet
Copy link
Author

if I use side-by-side all ok
http://gyazo.com/dad28271ba5299e76cf93c0ee00aa221 (gif)
if I use one div and set 3d view vector data aren't loaded
http://gyazo.com/84da8c4dd775755751b50d394544f1ab (gif)

@FizrukBet
Copy link
Author

i need to trigger event of load data when 2d view is disabled.

@jmgomezpoveda
Copy link
Contributor

This could be related to the second point at #346.

My workaround as of now is, after the load of the vector layer (in my case from a kml file), to switch to 2d view and back to 3d (#346 (comment)). On the brief time that the map is in 2d, the vector layer is loaded, and is available once I am back in 3d. The only drawback is that there is a flicker due to this switch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants