0
I’m starting in Openlayers and I’m having a problem visualizing polygons on maps. I have a set of polygons being returned from a query in the database (postgres/postgis). This set of polygons is passed via json by an ajax request to the frontend where I plan to use the Openlayers3 library to display these polygons on a map.
Example of return as KML:
{st_askml=<MultiGeometry><Polygon><outerBoundaryIs><LinearRing><coordinates>-53.460269936027402,-24.954734829872194 -53.460072335178054,-24.954744520125182 -53.460093771307605,-24.955104793997403 -53.460291372725941,-24.955095103672289 -53.460269936027402,-24.954734829872194</coordinates></LinearRing></outerBoundaryIs></Polygon></MultiGeometry>}
{st_askml=<MultiGeometry><Polygon><outerBoundaryIs><LinearRing><coordinates>-53.459896169834188,-24.955114484062349 -53.459874734273619,-24.9547542101181 -53.459701833437066,-24.954762688648493 -53.459723268499758,-24.955122962655768 -53.459896169834188,-24.955114484062349</coordinates></LinearRing></outerBoundaryIs></Polygon></MultiGeometry>}
What would be the best way to create the vector layer with these polygons using OL3? Saving the set of polygons in a file and using this file as source for the layer? Using json itself as source for the layer? (is there such a possibility?) and what the syntax of this layer would look like in OL3?