I'm working with Openlayers and I would like to add a custom layer to a map with markers from a webservice.

It should works in this way:

  • I create a map with Openlayers UI and display it in a page;
  • I call an external webservice that returns me X elements with lat/long informations;
  • I show these elements in the map as a normal layer, with markers etc.

The questions are:

  • Have I to create with Openlayers UI a custom layer and then I've to populate it with js/ajax?
  • Or I should create a map without a layer and add this layers js/ajax, and popoulate it with js/ajax?

1 Answer 1


One way to do this is with a views geojson layer. This seems to be the only way that works right now...at least for me.

With static data, you create a views display of type feed (create a view with no page or block and set it to type feed). Then, set the format to geojson. You'll have to set the settings to your geofield, and add your geofield as a field to the view. Then finally, create a layer through the OL UI and set your feed as a source. Hope this helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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