OpenLayers: Difference between revisions
Brian Wilson (talk | contribs) |
Brian Wilson (talk | contribs) |
||
Line 13: | Line 13: | ||
== OpenLayers 6 is coming == | == OpenLayers 6 is coming == | ||
Version 6 in beta now. I have started using it so that my project can keep up. | |||
Here are the steps I took to work with the beta, along with the command I used. | Here are the steps I took to work with the beta, along with the command I used. | ||
# I cloned | # I cloned OpenLayers source from github. '''git clone [email protected]:openlayers/openlayers.git''' | ||
# I moved to the beta release. '''git checkout tags/v6.0.0-beta.11''' | # I moved to the beta release. '''cd openlayers; git checkout tags/v6.0.0-beta.11''' | ||
# I built it. ''' | # I built it. '''npm install && npm run build-package''' | ||
# I removed ol 5 from my project to make sure it will use the beta. '''cd ../ol-react && npm uninstall ol''' | # I removed ol 5 from my project to make sure it will use the beta. '''cd ../ol-react && npm uninstall ol''' | ||
# I copied the new package into my project. '''cd ../ol-react && cp -r ../openlayers/build/ol .''' | # I copied the new package into my project. '''cd ../ol-react && cp -r ../openlayers/build/ol .''' | ||
# I told npm to use it. '''npm install ./ol''' | # I told npm to use it. '''npm install ./ol''' | ||
You can run the OpenLayers samples too. '''npm start''' and go to http://localhost:8080/ | |||
In my project's home page (example0.js) I added 2 lines of code, | In my project's home page (example0.js) I added 2 lines of code, | ||
Line 30: | Line 32: | ||
and added a little bit to the JSX portion. | and added a little bit to the JSX portion. | ||
. | . | ||
Currently using OpenLayers version {VERSION} | |||
== Books == | == Books == |
Revision as of 01:15, 24 July 2019
Search for OpenLayers on this wiki to find other relevant pages. Or look in the category.
What is OpenLayers?
OpenLayers (http://openlayers.org/) is Javascript code you use on your Web server. You reference it from your own HTML and Javascript based pages, to put maps into your web site.
Docs for programmers: http://openlayers.org/en/latest/doc/
OpenLayers is very stable code. It supports tiled raster and vector layers. It supports editing. It seems to support everything that I want to do.
OpenLayers 6 is coming
Version 6 in beta now. I have started using it so that my project can keep up.
Here are the steps I took to work with the beta, along with the command I used.
- I cloned OpenLayers source from github. git clone [email protected]:openlayers/openlayers.git
- I moved to the beta release. cd openlayers; git checkout tags/v6.0.0-beta.11
- I built it. npm install && npm run build-package
- I removed ol 5 from my project to make sure it will use the beta. cd ../ol-react && npm uninstall ol
- I copied the new package into my project. cd ../ol-react && cp -r ../openlayers/build/ol .
- I told npm to use it. npm install ./ol
You can run the OpenLayers samples too. npm start and go to http://localhost:8080/
In my project's home page (example0.js) I added 2 lines of code,
import {VERSION} from 'ol' . and added a little bit to the JSX portion. . Currently using OpenLayers version {VERSION}
Books
OpenLayers is so popular that there are even books about it! None for version 5 yet that I know of. I removed all the books I had listed here because they were all more than 2 years old. :-) You can look in the History tab if you really want.
The Marin library has ebooks via Safari but they are for version 3.
I bought OpenLayers 3.x Cookbook and I am going through it. Yes.. OL 4.x is out, but the big break was 2->3, 3->4 is a smaller jump and there aren't books on 4 yet. Or 5.
My test samples
live server
Lately I have been working on https://map46.com Sometimes I have http://maps.wildsong.biz/ up on Bellman.
at github
Currently I am using Node.JS and testing on my desktop. You can see code I have running here: https://github.com/brian32768/map46 and https://github.com/brian32768/OpenlayersTests
For the first week I extensively used Microsoft Visual Studio and Parcel. Since then I have learned enough JavaScript that I've just been using Emacs to edit, Parcel to build, and Chrome to test and debug.
That project has samples with OpenLayers 2, 4, and 5 (3 and 4 are the same basically so only one). Because there were BOOKS on 2 and 3 I started there and built samples, got them running and then stepped up.
There is an example using XYZ so that I could test an ESRI tile server.
Now I am now adding a Bootstrap + OpenLayers sample so that I can make something that looks like a real web site.
OpenLayers + ArcGIS REST
OpenLayers and React
I have a separate page on React.
Three sample projects on Github, all stopped at OpenLayers 3.
This one actually just loads and runs, making me happy. Pirmin Kalberer's OL3-React-Example Works right out of the box.
Richard Hill's ol-react. Took me 1/2 a day to get it to build but there is no example on how to use it. Bad for me, a React newbie.