Reputation: 1061
I started in the mapping. I would like to view a map of France with a layer on top that would be personalized.
I already have the custom layer with shapefile format. I do not know at all if I have to create an OpenStreetMap server or if I can use the web application directly.
Can you give me a starting point for mapping display with my extra layer shapefile format?
I guess the task is complex, but you have to start somewhere by ...
thank you very much
Upvotes: 4
Views: 10348
Reputation: 4870
You don't need to create an OpenStreetMap server by your own.
If you want to display your custom layer on a map then use google
or openstreetmap
as a base layer and display your layer (comes from shape file) on the map.
Upvotes: 1
Reputation: 1
You can use gipong/shp2geojson : first, you convert the shp file into geojson data Then you add your data to your map
var map = new ol.Map({
layers: [
new ol.layer.Tile({
source: new ol.source.OSM()
})
],
target: 'map',
view: new ol.View({
center: [0, 0],
zoom: 5
})
});
loadshp({
url: 'demo/10tnvillage.zip',
encoding: 'big5',
EPSG: 3826
}, function(data) {
var feature = new ol.format.GeoJSON().readFeatures(data, {
featureProjection: 'EPSG:3857'
});
var layer = new ol.layer.Vector({
source: new ol.source.Vector({
features: feature
})
});
map.addLayer(layer);
var extent = layer.getSource().getExtent();
map.getView().fit(extent, map.getSize());
});
Upvotes: 0
Reputation: 5559
It depends on what you want to do. Is it a big Shapefile?
You can do a few things while create an openlayers map:
Upvotes: 8
Reputation: 8767
If you wish to add a OpenStreetMap (OSM) over your shapefile layer, simply add the following line of code,
var osm = new OpenLayers.Layer.OSM();
map.addLayer(osm);
Though I did not understand, why do you need to create a OpenStreetMap server for?
Upvotes: 2