Tuesday, 30 October 2018

How to use Openlayers3 library files in codeigniter View files

I am trying to use openlayers in my codeigniter for showing some map information when a user visit some place.

But I am stuck in initial stage. I know this is a stupid question, but I really need to use it.

I can use the Openlayer librarys like Vector, GeoJSON etc.. on main.js as it is mentioned in their website by running node.js.

But in codeignite I want to use it in a particular view page. So how can I import those js file in a particular view page.

Let's say I have my openlayer modules in root foler

Like
Porject
-- Application
-- openlayers_modules 

// which have ol folder inside it. -- system

-- stylesheets
-- index.php

In a normal way, we use it as index.html and main.js, both are in root folder.

I am kind of confusing how to use it.

If I use those js files in a view file ex: lightning.php then it shows like

<script type="text/javascript">
import Map from 'ol/Map.js';
import View from 'ol/View.js';
import GeoJSON from 'ol/format/GeoJSON.js';
import VectorLayer from 'ol/layer/Vector.js';
import VectorSource from 'ol/source/Vector.js';
import {Fill, Stroke, Style, Text} from 'ol/style.js';

Uncaught SyntaxError: Unexpected identifier

So my question is how can we implement it on a particular view page in a codeigniter application with node js and without node js.

Any help is appreciate. Thanks



from How to use Openlayers3 library files in codeigniter View files

No comments:

Post a Comment