c# - A better way to create a pin point on the map -
i want create form user can enter address information. @ beginning, form shows text-boxes , map centers point.
when user enters information , reopens form, want pin point created point out location (if available).
i searched myself , unsure best way.
i willing use kendo asp.net in order complete this.
i assuming have database/web service provides geo data, , using address users provide.
to need add layer of type marker
, bind datasource supplies coordinates. see binding markers remote data.
@(html.kendo().map() .name("map") .center(30.268107, -97.744821) .zoom(15) .layers(layers => { layers.add() .type(maplayertype.tile) .urltemplate("http://tile2.opencyclemap.org/transport/#= zoom #/#= x #/#= y #.png") .subdomains("a", "b", "c") .attribution("© <a href='http://osm.org/copyright'>openstreetmap contributors</a>." + "tiles courtesy of <a href='http://www.opencyclemap.org/'>andy allan</a>"); layers.add() .type(maplayertype.marker) .datasource(datasource => datasource .read(read => read.action("_storelocations", "map")) ) .locationfield("latlng") .titlefield("title"); }) )
when user enters address information can use ajax request call controller , retrieve data:
$.ajax({ type: "post", url: '@url.action("_storelocations", "map")', contenttype: "application/json; charset=utf-8", datatype: 'json', data: { addressinfo: info }, success: function (result) { $("#map").data("kendomap").layers[1].datasource.data(result); } });
Comments
Post a Comment