save and load geographic data in leaflet - leaflet

I am new to leaflet, I have a requirement of creating a leaflet map where users can add location data. Such data need to be saved somewhere and then restored when the map is loaded again. Rest services need to be implemented to save data and load saved data.
I have already utilized the plugin leaflet.draw to implement part of the requirements; I need your recommendation on the best format and place (file, DB) to save the geographic data.

You would probably be interested in Leaflet "bookmarking" plugins:
Leaflet.Bookmarks: Highly customizable Leaflet plugin for user-generated bookmarks, stored locally or on the server. Demo.
Leaflet-Storage: Manage map and features with Leaflet and expose them for backend storage with an API. Demo.

Related

Tile styling in Open Street Map (with Leaflet)

Is it possible to use different colors for Tiles in Open Street Map?
In Google Maps API you can style the map - is there a same feature in Open Street Map or even better are there any different tile templates on the web for download and use in OSM?
OpenStreetMap project provides map data. In order to display web maps OSM data needs to be pre-processed and rendered. Depending on whether you use raster (for example default leafler) or vector tiles (mapbox-gl) steps to modify styles are completely different. Raster styles are usually generated using mapnik rendering library with mod_tile and apache web server. OSM data needs to be imported into PostgreSQL database. Depending on the amount of data you want to process it can take different time from couple of hours for single city to days for the whole planet and require very good hardware (6-8 cores/ 32 GB ram and higher). Then you need to edit special CartoCSS styles to change map appearance. Vector maps and tiles is completely different story but it will require comparable efforts to create your custom map style.
What I suggest is to go and find OSM maps provider that have different styles from default OSM by the way here is an excerpt their tile usage policy (https://operations.osmfoundation.org/policies/tiles/):
OpenStreetMap data is free for everyone to use. Our tile servers are not.
So look at these providers, they can save you a lot of time and money:
https://openmaptiles.org
https://getmaps.io
https://stadimaps.com
and others from https://switch2osm.org/providers/

Web Mapping application. Use of Geoserver: YES or NOT?

What are the benefits and / or needs to use Geoserver in the development of a web mapping application?
In other words, is it required to use a server such as "Geoserver" for the optimal development of a web mapping application?
I have created a web mapping application with Leaflet to publish geological and geophysical data. All data are already conditioned to be displayed in an Internet browser (data formats and styles are ready). My data and assets are stored in folders in the Apache directory of my PC. The application works and runs "perfectly".
Why should I implement Geoserver (or MapServer)?
I will really appreciate suggestions/opinions.
Of course, there is no reason that you have to implement GeoServer. However, there are variety of reasons why others do. Here are just a few.
GeoServer would allow you to manage datasets that are far larger than those that can be managed within a browser.
GeoServer can serve data through a variety of services, including WMS, WFS, WCS, WPS, etc.
GeoServer / GeoWebCache continue to perform well in environments with lots of geospatial data and lots of users.
If you thought that you might want to consume a variety geospatial data sources, then GeoServer is useful. It can consume all sorts of other geospatial data sources, including ESRI, PostGIS, OGC, etc. In fact, via GeoWebCache, it can even cache that data within your local network and reduce traffic to the external servers. GeoServer can even unify data from these disparate sources onto single layers (group).
GeoServer has lots of great styling options. You can use SLD, CSS, and Mapbox styles. Styles can be property and scale-sensitive.
GeoServer can transform data from a source on the fly.
Hope this helps.

How to intagrate Open Street map editor iD withe geoserver data or planet osm database

I am trying to create my own map with the help of osm data and geoserver,successfully partially completed it with my own SLD..Now I need a web editor for edit that map data .I select "iD" for it. i don't know how to configure it with my planet osm data base
You need to keep in mind, that your current setup is designed to work for rendering only (so an OSM like basemap).
So what you IMHO need:
OSM API services
This is called rails port and is a bit tricky, as it's pretty unusal to clone the whole OSM infrastructure for "usual devs". Please be aware that you also need to think about how you want to deal with your and the official data, as you create some 'fork' of the planet and create a parallel world dataset (update workflow, sharealike license, ...)
Own iD instance
You should also host your own iD instance (or adapt the JOSM settings for each user) so you can contribute via your own API services from step 1.

Custom Map draw with MongoDB

Can anybody say, how can I draw custom MAP vector map (dynamic) with using mongodb's Geo-spatial data?
Or I look for Map maker with using mongoDB.
Thanks.
MongoDB's default data storage is now GeoJSON, see the GeoJSON docs. This format, being an extension of JSON, naturally plays very well with Javascript. There are direct GeoJSON loaders in Google Maps, OpenLayers and in Leaflet, three of the better known Javascript mapping libraries out there. Both OpenLayers and Leaflet are open source, so you can view the source to see how it works and extend as you wish.
You will have to write something to transmit the GeoJSON from MongoDB to the client and you might have to deal with cross domain issues, depending on your setup, see JSON: How do I make cross-domain JSON call for possible solutions.

Map rendering using OpenStreetMap

Does OpenStreetMap just provide GIS data? To render maps and have a browser based UI to show maps with data, would a developer need to use something like Mapnik?
OpenStreetMap provides data yes, and you'll need specific tools to make map with them. You first need to put the data in a true GIS format, which OSM is not. Think about PostGIS, an osm2pgsql tool is designed for that. Then, you'll need a rendering tool, i.e. a cartographic engine. You can use Mapnik or MapServer. Tilemill or Kosmtik can help you designing your map styles.
Take a look here.
yo can export data form OpenStreetMap and render your own map.
Take a look at
http://www.slideshare.net/jones139/rendering-openstreetmap-data-using-mapnik
http://www.slideshare.net/artemp/mapnik-sotm-2007
There's a fuller list of rendering libraries for OpenStreetMap data here, both free and commercial.
http://wiki.openstreetmap.org/wiki/Renderer
Disclosure: I am the developer of one of them.
OpenStreetMap provides map data out to a wide sprawling ecosystem of different downloads and tools offering developers different map-making and map using possibilities. Here is a diagram I drew which captures some of this:
So the data comes out of the core of OpenStreetMap, in the form of 'planet downloads', one big unwieldy blob of XML (and diffs), but from there it fans out into a range of other offerings to developers, many of which are provided by 3rd parties. Taken together "OpenStreetMap & Friends" provide lots of possibilities.
If you are inclined to run your own rendering system, then yes, Mapnik is a good choice. Powerful and scaleable (most successful OSM tile servers run Mapnik), but takes a bit of setting up. You normally load OSM XML data into PostGIS, and run mapnik from that (tutorials on switch2osm.org)
If you are not inclined to run your own rendering system (for more lightweight web development tasks this seams reasonable!) you don't have to! You can configure LeafletJS or OpenLayers or others to fetch map tiles from a tile server run by somebody else. There are many providers. See the providers list on switch2osm.org and the Tile Servers list.