Marc studied geography, geology, and urban development and did his internship at a small local GIS company. In 2006 he made his first contribution to the OpenLayers library, and it was so well received that it was described as a “model contribution.” It was later reverted and removed, but that’s beside the point here. Marc saw the library’s potential and how aiming for less than the highest-quality contribution was not worth doing.
Here’s the thing.
Marc is self-taught with no formal education in programming or computer science. He tinkered with homepages during his studies and learned the building blocks of OpenLayers by himself.
IF YOU INVEST THE TIME, YOU CAN DO IT
Programming languages can feel out of reach for many because the technical standard is high. Open-source crowds are doing amazing things, and a newcomer might feel it’s difficult to get involved.
Sure, there are amazing people and code out there. But once you get to look into the code, it’s like text files; you experiment with them, and then you will be able to contribute somewhere. There’s great code out there—with at least the same volume of bad code. Small things always need enhancements, and anyone can do this who is familiar with the basics.
It’s a fully grown-up programming language. It runs both in the client and on the server, such as when you visit modern websites where you can edit documents or spreadsheets.
It’s also running on just about every device that exists—not only in browsers in the client, but on servers.
It’s a fun language that evolved a lot over the last decade. It started out as an experiment; it has nothing to do with Java, except for the name and some syntax.
We need to dig deeper to see it elsewhere.
PHP is something that’s used on many servers. It produces dynamic sites to query databases and websites that are not statically written but fetch content from elsewhere and then present it to the user.
WHAT IS OPENLAYERS?
WHAT’S THE VISUALIZATION LIKE?
OpenLayers reads all kinds of data formats with a geospatial component. For example, a simple GeoJSON file containing vector data and points that have some attributes.
It can also read and display KML, GML, and pre-rendered tiles. OpenStreetMap produces great tiles of their database that you can use to create a nice background map on your map application.
OpenLayers combines the different sources and stacks them on top of each other. It’s a flexible solution for your mapping needs.
IS THERE ANYTHING FOR STACKING AND LAYERING DATA?
OpenLayers shines in many parts, including projections and handling different projections.
Any data format has an explicit or implicit specification of where those coordinates are located and how they should be interpreted. OpenLayers understands 99% of them.
Vector data is raw coordinates and you can read it with many things. Raster data is pixels. Suppose all you have is tiles or geospatial raster data in one geographic projection. In that case, it’s a challenge to combine it with different projected coordinates or data from other web sources.
OpenLayers makes it easy to re-project vector and raster data to the specified projection.
Not quite. It’s a platform for combining sources and interacting with other libraries.
OpenLayers have basic ways of handling the two most common projections. It delegates anything above basic to the real expert, which is Proj—the de facto standard of doing projections.
The small micro modules do one thing only—but they do it exceptionally well. When things become too hard or too specialized, you use a library that’s already out there to help fix your specific problem.
WHAT KINDS OF INTERACTIONS CAN WE DETECT AND USE?
There are a lot of interactions already built into the library.
The most basic ones, like zooming in and out on maps, are included. You can also pinch the map to rotate it, just like in Google maps.
OpenLayers doesn’t stop at displaying vector data. You get tools to edit it—create new points, digitize new polygons, rotate existing polygons, etc. Everything you can do on a map on the web, you can do in OpenLayers.
HOW’S PINCHING DETECTED ON DIFFERENT DEVICES?
When you put your fingers on the map, touch events are registered. Your fingers touch your display at two places (this process was standardized not so long ago). It’s easy to differentiate whether there were two touches (two fingers), and they’re now moving to the outside (with the distance between them getting bigger), or inside (the distance is getting smaller), or they’re also rotating something.
All this happens internally. It’s not detecting whether you’re using a mobile phone or a desktop, but it’s automatically detecting the device’s capabilities that’s running your code.
WHAT ABOUT IN-DEPTH ANALYSIS?
Depends. How do you define in-depth?
There are basic ones available, like measurement, you can draw lines and measure their distances. There are utility functions to help you calculate how many meters are the two points of a line apart.
There’s also editing and snapping one vector to another.
DOES IT ANALYZE RASTER DATA?
Few people know about it, but it does.
There’s a way of accessing raw pixel data of sources when they allow it, so you can either analyze it or produce your modeling ideas onto your map.
Imagine moving a slider on the page to show the impact of a 15-centimeter sea water level rise and the land affected by it.
Or calculating the vegetation greenness index on an arbitrary raster source. Move your mouse over a map and the greenness is calculated on the fly with a small formula built into it.
There are a lot of opportunities to extend on the building blocks in OpenLayers.
IS THERE ANY PARTICULARLY INTERESTING LIBRARY THAT WORKS WELL WITH OPENLAYERS?
For geospatial libraries, you have gazillions of choices. I recommend Turf.js and GSTs (part of the Java topology suite).
GSTs works great with OpenLayers and does standard vector analysis very well. Say you have two points and you buffer them each by 10 km. You calculate the intersection of those new polygons, take this intersection, rotate it around, and you see how big the covered area is.
There are smaller libraries out there, such as ArcGIS, that calculate circles. Give it two points, say San Francisco and Berlin, and it calculates a great arc or how you’d fly there.
These are just quick examples of creating stunning applications for geospatial projects where OpenLayers does some parts, and another library some other parts. Together, they give you outstanding results.
IS THIS 2D OR 3D?
All vector data in OpenLayers (v.6) is 3D by design.
Back when we started, we only knew about 2D (v.2). Later, we created all the basic building blocks for vector data with 3D in our heads.
For displaying 3D data, most people use Cesium. We’re toying with the idea to support 3D directly in OpenLayers in the near future.
Watch this space.
Yes. It can solve geospatial questions, especially for displaying stuff on the web where everything is moving.
It’s the future of the web and programming.
Users like to focus on Python, R, Java, and C#.
Some big applications and programs that have been around forever were written with older languages, such as C. There weren’t that many choices at the time. C was a good choice for many things—geospatial data is extensive.
But it has a high entry barrier. I wouldn’t have started programming if I had been thrown into some company doing C# or C.
Programming for geospatial is fun. You see something interesting every time you program with it. It’s visual. Maps, diagrams, modeling results. It’s practical and you can explain it to your parents. It’s a good choice to start with and excel later on.
Absolutely. The future is bright. It’s here to stay and evolve.
You get an easy start, but if you want to get the best out of it and produce easy, reusable code, you have to put in more. You’ll be well rewarded.
What’s that famous interview question?
“What’s your favorite programming language?”
To which there is no perfect answer.
If someone says, “It depends… but I’m most familiar with X,” that means they thought of programming and solving stuff with X.
They haven’t really thought about it at all.
I WANT TO START. DO I NEED A SERVER?
No, you don’t.
You need a browser. Every computer has a browser, so you need nothing at all.
There are brilliant editors (or IDEs) out there. I recommend Visual Studio Code. This is advanced, but you will want to do it as a real programmer, eventually.
Just watch a 5-min course.
Then you’ll get thirsty for more.
WHAT COMMON MISTAKES ARE PEOPLE MAKING?
One is mixing up Lat and Long. I still have to find a developer that hasn’t done this regularly.
The other one is going for a full build and building a map that looks amazing, but it takes five seconds to load on a mobile device. Page visitors are gone, never to return.