I am totally confused with this openlayers map. Even there are many examples and wiki, i could not find how to reuse it. I mean i want to show my city map with managable by admin, admin can add points and locations and it should displayed in front end. Please开发者_JS百科 please help me how to do it?
Like Conley writes, OpenLayers is mainly a JavaScript utility for displaying geographical data. Thus it requires that you have access to the geographical data you want to display. OpenStreetMap and Google Maps are free, and there are plenty of examples discussing how to use them -> here or on OpenLayers.org.
I would suggest that you focusing on displaying the data (your city map), and then implement the admin part where you use OpenLayers for adding geometry like points, lines and polygons afterwards. Remember that if you want to store geometry, you will need a server like GeoServer or similar.
Happy mapping :)
You can check out the "draw features" example to see how to make points. You enable this for admin, store the geometries of the vector layer where you are drawing your cities in a hidden field using the OL parser, and on submit you store this in a geospatially enabled database.
When displaying the map, you get the geometries from the database, read them with the OL parser, and put them on the vector layer of the map. The JSON parser can be found here: http://dev.openlayers.org/releases/OpenLayers-2.8/doc/apidocs/files/OpenLayers/Format/JSON-js.html
OL is just a front end. You can't expect it to do any back end work for you.
精彩评论