Create web mapping application. Leaflet or OpenLayers? - javascript

I am creating a complex web mapping application (with size files 500 MB GeoJSon and Shapefile), and I use Javascript, GeoServer and Postgis,
I started to create the application with Leaflet, I'm documented a little more about Leaflet, I found that Leaflet is less stable and less powerful with Geoserver and large files.
I have two questions please:
1/ I decided to create an other application and use OpenLayers, what do you think about OpenLayer s? for this kind of application (Complexe application).
2/ I also need the backend part, I do not have an idea of ​​the language that I'm going to use, what I have to use NodeJS or PHP for this kind of application ?
Thank you,

I would strongly advise against Leaflet. The main reason for that is that Leaflet doesn't have the concept of Features. Any feature added to leaflet is added as a separate layer. So a feature is a layer in Leaflet. Features are inherent to GIS applications that is why they exist in other GIS libraries, applications and GeoFormats like: ESRI JS API, OpenLayers, QGis, Udig, GeoJSON, shapefile, etc. So the reason for Leaflet not adhering to these concepts is unclear to me. Perhaps someone else can enlighten us?
For the backend part, it really depends on what you want to do and the requirements you have. A backend can be written in almost any language. You can also use existing solutions like GeoServer, ArcGIS Server and MapServer, these servers support, in various degrees OGC standards like WMS/WFS/WMTS.

Related

android map api overview and choice

I want to create an app with android studio that will use a map and show the device location on it. Also i want to show markers on the map and be able to click them and interact with them.
A lightweight and fast solution(there will be frequent updates of locations) is best of course.
I searched a bit and found the solution of google maps api.
This has an api solution for android but i then found other options like
leaflet, openlayers and probably there are more.
Leaflet though and openlayers are js and after searching how to implement it i found i have to use a "webview".
I could not find any other native solution like google maps that is as open source as leaflet or openlayers.
At first i though to use leaflet since google maps was not so open source and could ask for money after some use of the maps. Also i want to use custom markers.
What library should i use?
Does using js and webview have a considerable impact on speed and performance over native libraries?
Is it difficult to interact with the js - to change/create markers, display text and stuff and move the marker as the user moves?
I am new to android development any advice that will point mistakes at my thinking are welcome.
The best approach is to develop a hybrid app so that you can bring the best of both JS and JAVA world together.
We have successfully developed a hybrid app based on leaflet for a large enterprise in India.
As as far as the hybrid apps are concerned, you can use Iconic framework. You can perform/customize all the map related functionalities which leaflet offers.
We have not seen any performance lag(tested on Android 4.4, 5.1 and 6.0)

Graph visualization frameworks

I want to visualize a Neo4j database in a graphical application. (I'm doing this primarily as a learning exercise).
I want it to behave almost identically to the visualization in Neo4j's WebAdmin: When the graphic appears, I want to see the nodes moving around as they settle into their final locations, and I want the user to be able to click and drag node icons around the screen and have them stick where they are dropped, with the rest of the graph adjusting to account for the change.
I have two questions.
What are the technical terms for the three requirements crudely described in the paragraph above?
I'm a Java programmer with no experience in JavaScript, but I'm thinking that, with this project, it's time to get some - sigma.js in particular seems very powerful and relatively simple. However, ultimately this needs to be done within a Java Swing application, and while I know there are various containers I can use to embed JS/HTML content into Swing, still it seems that a pure Java solution would be ideal, and I'm curious about any frameworks that might make this possible. I'm looking into Gephi now, but it doesn't seem anywhere near as powerful or as simple to use as sigma.js. Am I wrong in this assumption?
To summarize the second question: Which would be the better investment of my time: Learning sigma.js and the various JS frameworks (which will require me to get comfortable with JS in general), or learning to use Gephi in Java? (assuming I have a general and long-term interest in graph visualization)
Java visualization
Gephi does provide a toolkit for Java and Python which doesn't contains the UI modules, so unless you want to use Gephi itself to visualise your network you cannot embed its UI in your Java/Swing application as long as I know.
The toolkit contains all the algorithms and plugin infrastructure so if you want to use some of their analysis tool embedded in your app you can use that, otherwise I don't think it's your case.
There are other Java options if you want for graph visualisation here: Java graph library for dynamic visualisation
About Gephi and sigmaJS
IMHO Gephi is far more powerful than sigma.js: it has full SNA tools, multiple layouts, a data editor, exporters, plugin-systems...
One important factor is also the size of the dataset you want to visualise: while sigmaJS can handle up to 500 nodes in the view, Gephi can layout easily 50000 nodes with GPU support as well.
Gephi is a scientific tool made for people that don't want to code to visualise a network and it does it's job. SigmaJS is one of many JS solutions to visualise graphs on a web page.
You can always export to sigmaJS from Gephi with a plugin.
What's better?
At the end of the story I guess the tool you are going to use will depends on:
do you have to visualise a big dataset? -> Java solutions will win for big ones
do you need to distribute it easily? -> Web app / SigmaJS wins for distributed
do you want to have a full integration with your app? -> Java wins
The best one I've found is Keylines, but its not cheap.
Gephi is OK, but the last time I looked it did not support Neo4j 2.0
If your a programmer Neo4j is open source, so you can fork the repository on Git and use that (you will have to check the licencing model before you commercialise any product though)

Clickable continent/country maps: which way to go?

There are many Web sites that include clickable maps that highlight regions on mouseover and allow the user to narrow down a selection from a world map view to a continent level. Here is an interesting example: davidlynch.org.
Many of these clickable maps are implemented with HTML image maps, while another option is to use for example Google's GeoChart API. Concerning the HTML image maps option, I'm wondering where people get all the 'raw data', all the country and regional border polygons. Is there a free resource for that? Concerning the Google GeoChart option, I'm wondering if that is scalable or if the number of API calls are somehow limited?
Does anyone have some advice on the availability of a free library that allows a straightforward implementation of clickable maps with customizable regions?
Well it is not really a problem which could be tagged 'geocoding'.
Since I have been playing with Raphael.js these days, I thought of this lib while reading your question title. I also remember Wikipedia commons hosted a SVG map of the world. Raphael helps you manipulate svg files, so that could be a nice way to go.
Anyway, after searching whith the criteria 'raphael' I found a conversation matching your request, exactly. So there it is : http://groups.google.com/group/raphaeljs/browse_thread/thread/46b5402c677ce274/7ff6a6a8d8f5f9fa?pli=1
There are some utility scripts, as well as the link to the svg world file mentioned above and a live examples (and links to Stack Exchange topics).
Sure there is work to do, and it may be easier to call directly the google api.
In my experience of the gmaps API, you have to make many requests per second to be blacklisted by google. Like when you launch a heavy batch geocoding tool. So it depends of your project but I would consider quite safe to use it even if your page is popular.
[EDIT] : There is now a live demo on RaphaelJs website.
[EDIT again]: And now a complete production workflow based on Python and Raphael exists : Kartograph. It's really young but looks promising.
Check this out. Seems to serve your requirements and offers a bit more:
Google Maps with Clickable Regions
http://codecanyon.net/item/google-maps-with-clickable-countries/3186942
I second the raphael.js, it is a nice library to draw the shapes with all kinds of user interaction. As an example, you may look at this project, which is a vector map of Russia, implemented on top of the Raphael.js. It allows highlighting the regions programmatically.
There are two libraries I can recommend without doubt: 1. d3JS and 2. Raphael JS
The latter is what I was using for writing my
clickable map generator web application - Make a Clickable Map
d3JS has a steeper learning curve, but you can do way more things with it than Raphael. On the other hand, Raphael is easier to pick up and is fun to work with.

Bing Maps - Javascript vs Silverlight

Currently, I am evaluating the creating of a map based system to plot data. This data would consists of shape layers (a grid - stored in a SQL 2008 Geography column) and multiple points (~5500 initially - Lat/Lon points in the same DB) that will plot the location of items on the grid. So, my question is - is there a large difference between the SilverLight Bing Map implementation and the JavaScript based implementation. Here is what I can gather from my research:
SilverLight Pros
Can handle large amounts of data more quickly
API/SDK to tie directly to .NET application code
JavaScript Pros
Do not have to download/install Silverlight on client side
Can leverage JQuery or other frameworks to pull data from webservice (I know SL can do this to using WCF, but I know JQuery rather well)
I know from this list that it looks like I should go with Silverlight, however I also have 'NEVER' done a bit of coding using the XAML stuff. Most of my experience as of late is the .NET MVC stuff and I cannot help but to take that into account as well. Does anyone know the performance 'ratio' between SilverLight and Javascript or at what point JavaScript implementation will choke? One more thing, I have looked at the DataConnect project on codeplex, but it seems to be broken - I cannot get the WKT or XAML functions to work either on their live site or the downloaded project.
If anyone out there has done a comparison/has words of wisdom for guidance/can add to my list for either of the two, I am all ears.
EDIT
I found a great Javascript/.NET MVC application example using SQL 2008 on CodePlex - Ajax Map Data Connector. It gives examples of pulling polygons, lines and points of interest from the database, placing them on the map using images tiles or the MS API as well as using intersection to determine items around a point or within a bounded box.
Personally I prefer the Javascript version because it's more multiplatform (e.g. mobiles) and easy to integrate in a webapp (plus I also love jQuery), but I think the deciding factor is probably what do you want to use the application for ?
However for Javascript, even if I love version 7, you may want to stick with version 6.3 for now because too many core components were removed (but are planned to be re-added in the future), e.g. infoboxes and client-side clustering (of course you can do your own implementations, that's what I did personally, but I would advise to use 6.3 for now).
I'd go with the javascript control (better support for multi-devices, is currently being more actively developed than the Silverlight control, sounds better suited to your skill set). However, don't try to plot 5,500 points on it. It will die.
What's more, if you're thinking about plotting 5,500 points then there's something wrong with your application design anyway - an end user is not going to be able to discern that many different points on the map. Let them filter for particular types of points, or only retrieve those that are visible in the current mapview, or use clustering to group up points at higher zoom levels - you should only be looking to have at most maybe 100 - 200 data visible data points on the map at any one time. If you really must plot that many points, then pre-render them as a tile layer and cache this rather than trying to plot dynamic vector data on the map.
And, I disagree with wildpeaks - v 7.0 is the latest stable release of the Bing Maps AJAX platform, and is a major change from v6.3. If you start coding with v6.3 now you'll only have to go through upheaval at a later date when you have to migrate to v7.0. Best to start off with v7.0 than learn a deprecated API.

OpenLayers vs Google Maps? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have used Google Maps a couple of times, but what wondering about OpenLayers.
Before starting any kind of coding, here are a couple of questions that come to my mind,
Why would I use OpenLayers instead of Google Maps?
Except for its OSS licence, anyway
Did you encounter any situation in which you'd recommend absolutly not using OpenLayers?
I did a search about "OpenLayers" on Stack Overflow; there are not many answers. Does it mean this solution is not used much? Could it be a problem for long-term viability of the project?
For those of you who have already used OpenLayers: are there any common pitfalls / problems I may encounter?
What about using a JavaScript Framework with it? I've seen it's using Prototype, and I know Prototype, so that would be OK. But what about using something else like MooTools? (Which is not compatible with Prototype, BTW)
Are there any kind of speed and performance related problems? I need my application to be responsive and can't wait hours to get a map displayed.
Are there maps available for many places, or are there lots of those missing?
That is, I'm in France, and need my application to work at least for big cities... Will that be OK?
if not, is it easy to find layers and visualisations for OpenLayers and integrate them?
Is there any kind of API to display roads?
For instance, to show roads that are one-way only.
If yes, how can I do that? Do I have to have some kind of file containing those roads information, and, then, display them on the map by myself?
Do you know any good tutorial to OpenLayers?
I have not tried it yet, those are just out of the blue questions...
These are a really great questions! I'm a professional OpenLayers developer and fan, so I'll address your questions from that perspective.
Why would I use OpenLayers instead of Google Maps?
Flexiblity: You are not tied to any particular map provider or technology. You can change anytime and not have to rewrite your entire code. Google, Yahoo, Microsoft, WMS, ArcGIS Server, MapServer, etc. are all supported out of the box.
Vector Support: Better support for points, polylines, and polygons.
Control: You have the ability to add any new features that you may need. I've personally written three plugins for OpenLayers, two of which are or will be part of the source.
Debugging: Much easier to debug when you can step through the source code!
I would not worry at all about the long-term viability of the project. It is the premier open source client-side mapping library.
Are there any common pitfalls / problems I may encounter?
The biggest pitfall I've run into is working with the Web Mercator (Google) projection. It can be a pain to display vector data that is in a common and real projection like WGS 84 into an OpenLayers map using Google, Yahoo, and Microsoft base maps. The examples are your friend.
JavaScript Framework Compatibility
I use the jQuery framework for all of my work, and the only problem I've had is referencing jQuery after OpenLayers. Other than that, it's been smooth sailing.
Performance is great! The only issues will be with your map server or adding too many vectors to your map.
Are there maps available for many places?
Like I said, you can use basemaps from just about any source for anywhere in the world.
Is there any kind of API to display roads?
I'd check out CloudMade! The have converted the OpenStreetMap project into a map tile service and allow custom styling. I believe that you can style one-way streets (per your example) a particular way. The CloudMade Developer Zone.
Do you know any good tutorial to OpenLayers?
I don't know any tutorials, but there are a ton of examples in OpenLayers Examples
I hope this is useful. And I'm around Stack Overflow if you have any questions!
It's not necessarily a question of OpenLayers OR Google Maps. You can after all use Google Maps for your map background in OpenLayers. Some more specific answers:
Why OpenLayers?
OpenLayers can combine maps from different sources (Google Maps background, WMS overlays, vector data from KML or GML files or WFS etc)
You can style OpenLayers much more thanyou can Google Maps
Open source, you can check the source code when debugging
If you need high precision in the maps, use OpenLayers with a suitable map server backend rather than Google Maps to get a better map projection (Google Maps assumes that the earth is a perfect sphere)
Pitfalls
If you want to use vector (WFS) data from another server you need a proxy, due to cross site scripting limitations
Performance
Depends mainly on the speed of the map backend
Displaying many vector features (limit is browser dependent, but say > 200 on one view) takes time, but that is more a browser thing than a problem with OpenLayers
JavaScript frameworks
Have a look at GeoExt, which is ExtJS + OpenLayers, for example
Available maps
OpenLayers doesn't come with a map backend. You can use Google Maps, Yahoo Maps, MS Virtual Earth etc, or any WMS and WFS service tou have access to
I haven't seen much of a presence from OpenLayers users on SO but they're out there. The OpenLayers mailing lists are pretty active (I'm on Users and Dev and see anywhere from 50-100 emails a day discussing various things. You can search the lists from those links too.).
I can't answer all your questions but one thing I'll put out there is that OpenLayers and google maps aren't mutually exclusive. OpenLayers is a javascript library and you can use it to interact with google maps. Check out this example: OpenLayers using google maps. And here's the main OpenLayers examples page.
It really depends on what you want to use the map for. To simply plot points on a map, Google Maps will be fine. The map layers for Google Maps are also quite detailed. OpenLayers on the other hand offers far more functionality and is very extensible.
OpenLayers have lots of examples to get you started.
As for maps, OpenLayers is only an API so you need to supply it will map layers. The Google Maps API will be limited to the map layers supplied by google. With OpenLayer you can display pretty much any publicly available map service (WMS, WFS, TMS, WMS-C). A very good example is openstreetmap.org - (global streets map collected by the community). OSM can be added to openlayers as a TMS layer. Check out this example for instructions.
One point that hasn't been fully made here is that using OpenLayers avoids various restrictions Google places on the terms of service for its map APIs, including:
You can't legally use a Google map solely in a section of your site that requires payment to access, or for a private site that the public can't sign up for (e.g. a corporate intranet). (IANAL, but see Terms of Service, 9.1 and the FAQ)
You can't legally (or practically) use the Google API for offline applications (i.e. where the tiles are served from your own machine). Even if there weren't legal restrictions, Google makes this technically very difficult, while OpenLayers makes it easy.
Google reserves the right to shut down access to the API if you're showing a map with content it finds objectionable. The example given in the FAQ is a map of illegal drugs, which gives a good sense of the gray areas this restriction might cover.
See this FAQ and the Terms of Service for more details.
All that said, as a long-time Google Maps developer who recently started using OpenLayers, I feel that Google Maps has better documentation, a larger user community, and a clearer and more stable API than OpenLayers. So you have to make a trade-off somewhere.
I agree with all answers, but there is one very important point that nobody mentions.
OpenLayers and Google Maps have different targets.
OpenLayer is an excellent framework to display geodata, but Google Maps is a pool of services that include a framework to display geodata among other services.
So, Google Maps expose a lot services and features that OpenLayes do not have.
Some examples of Google Maps features and services are region localization, sensor detection (for device with GPS) and user localization, geocoding and reverse geocoding, street view, etc.
Some clients may refuse, or have strong reservations, about using Google Maps. They may have valid concerns that Google may introduce advertising or change the API without notice.
However Google Maps does have the benefit of integrating with other Google services (placemarks, adding photos, geocoding services).
As its the web you can always combine many different mapping services and APIs.
I have used both APIs. I make a software for corporations and this software requires mapping but not all clients have a GoogleMaps license, so I need to support both types of maps.
I have made a common API for abstracting the differences between them and let me tell you, some stuff is easier to do in one than the other. Like limiting the bounds of where you can pan the map to, it is a lot easier to do in OpenLayers, but heatmaps are easier to use on GoogleMaps (it is officially supported by google, unlike the available OpenLayers plugins).
OpenLayers support offline maps. Some of my users are in private
intranets without internet connection.
GoogleMaps has two absolutely must have plugins, MarkCluster
and Spiderfier that makes possible visualizing a huge numbers
of markers.
GoogleMaps InfoWindows are easier to use and have better
usability than the OpenLayers.Popups. These are the little windows
that can open when you click in a marker. Googlemaps InfoWindows are
also a lot more pretty by default, you have to do some CSS wizardry
with the Popups.
GoogleMaps has streetview which is useful sometimes.
GoogleMaps has more features that you might need. Although many
features are present in OpenLayers too, but not officially
supported.
Usually in the end you should go with OpenLayers because of the reduced headache you might get from licensing and bandwith usage from googlemaps. Both handle basic mapping (ie, displaying markers on top of a map) very well. Unless you can find a specific feature you need from one that is not present on the other you should go for OpenLayers.
See this for more information about googlemaps billing and when you can use it for free.
Also GoogleMaps has its basic geolocation type as 'LatLng' and Openlayers use 'LonLat' which drives me freaking nuts because I keep mistaking the order of the parameters in function calls.
In addition to those who mentioned speed problems, I would like to add that IE's VML renderer can get really slow with a vector layer with many features. One user mentioned about 200. That's about exactly what I can add before IE slows down considerable to the point of freezing. If you add features that are text labels, you can add half less, probably because internally each text label consists of two VML elements.
In Google you may create a custom GOverlay whose content is a "div", which gets rendered without problems in IE.
A couple of things I would add, from two perspectives: client usage and data derving.
Client usage:
What are you clients used to using currently? Change can be difficult.
How much functionality do you really need? OpenLayers has quite a bit, but if you are not using it...
Data serving:
Are you serving KML data? If so, both OpenLayers and Google Maps will work with it, and you are probably going to have to decide based upon client usage.
Are you serving other types of data services? (WMS, WFS, CSV, etc.) If so, then OpenLayers very likely has examples and support for it.
OL has a large fanbase and is perhaps the most used Opensource geothing used in the world.
You dont see that many threads and posts about it in this cyberplace because people here tend to discuss other kind of techs, like JSF and Mobile (non geo), not because OL is like struts.
However Ol has some drawbacks, mainly that it's so low level that you have to write lots of code to do common ops. That can work in the good way too, because as a developer a: you have all the code upfront and b: tweaking and customizing is very easy.
There are more sophisticated free geotools, but all they do is call openlayers and abstract some of the more boring chores.
So use it confidently. It's mature, robust and it's not going to die in the foreseable future. However if you want to speed up your developing process you should try the other tools that mount in top of it.
have a nice day

Categories

Resources