none
How to find the pushpin within draw shapes RRS feed

  • Question

  • Hi,

    We have developed one application to show the pushpin within the draw shape(region). We used to DrawingToolsModule to draw the different shapes. We need to show only those pushpin on map those are fall within draw shape(region). We used some logic but it did not worked correctly it showed some pushpin outside the shape as shown in below screenshot.

    Can anyone have solution to resolve this issue. We need to show pushpin those are within region.

    Thanks!

    Balasaheb

    Friday, March 4, 2016 2:14 PM

Answers

All replies

  • You will need to do a point in polygon search. There are a couple of ways to do this. One option is to use a basic geometry calculation which may be a bit inaccurate, but good enough. Here is an old code sample:http://pietschsoft.com/post/2008/07/Virtual-Earth-Polygon-Search-Is-Point-Within-Polygon

    If your data is stored in a spatial database such as SQL 2008/2012/2014,SQL Azure, you can use the Well Known text module for Bing Maps, convert your polygon into text and then use the spatially accurate function in SQL to do an intersection test. Here is a blog post on how to do this:

    https://rbrundritt.wordpress.com/2013/08/01/how-to-create-a-spatial-web-service-that-connects-a-database-to-bing-maps-using-ef5/

    https://rbrundritt.wordpress.com/2013/08/06/advance-spatial-queries-using-entity-framework-5/

    Alternatively, there we also have a good white paper here:

    https://onedrive.live.com/redir?resid=D35222484A76A01!361218&authkey=!AMEJsKW8h_HUbOg&ithint=file%2cpdf

    Code samples for white paper can be found here: https://onedrive.live.com/redir?resid=D35222484A76A01!323177&authkey=!AId01rJ-JPDPZMw&ithint=file%2czip


    http://rbrundritt.wordpress.com

    Friday, March 4, 2016 6:55 PM
  • Hi Ricky,

    Thanks for providing the links. We are able to figure out the issue and resolved it.

    Thanks!

    Balasaheb

    Saturday, March 5, 2016 7:09 AM
  • Hi

    We are using code given in below link to point find in plotted region.

    http://pietschsoft.com/post/2008/07/Virtual-Earth-Polygon-Search-Is-Point-Within-Polygon

    We try to find the point which as Latitude: 34.06236 and Longitude: -118.39684

    Below is the collection of co-ordinate for which you try to find above points lie within it.  

    33.467198,-118.593969|33.43438,-118.563441|33.369914,-118.482608|33.326056,-118.465368|33.320065,-118.374767|33.299074,-118.325243|33.351463,-118.286261|33.409284,-118.370323|33.487483,-118.484784|33.467198,-118.593969||33.017129,-118.641578|32.931672,-118.581512|32.844589,-118.487907|32.800594,-118.425633|32.821962,-118.353503|32.895423,-118.44677|32.980933,-118.540069|33.035951,-118.594033|33.017129,-118.641578||33.278628,-119.578941|33.233405,-119.545871|33.215431,-119.464724|33.228166,-119.429559|33.266022,-119.42717|33.307269,-119.510489|33.278628,-119.578941||34.058351,-119.916215|34.023526,-119.876916|33.980374,-119.873358|33.962929,-119.795937|33.959582,-119.721206|33.985889,-119.662824|33.997819,-119.554471|33.996515,-119.487719|33.994635,-119.391586|34.000548,-119.363064|34.050794,-119.364213|34.054156,-119.442653|34.053996,-119.470736|34.053452,-119.566699|34.049298,-119.739472|34.071298,-119.857303|34.058351,-119.916215||34.028081,-120.454134|33.99178,-120.36484|33.956903,-120.200085|33.927993,-120.179049|33.895711,-120.121817|33.914562,-120.049681|33.94248,-119.97369|33.983947,-119.984316|34.037729,-120.055106|34.026086,-120.135852|34.057172,-120.24248|34.076465,-120.368277|34.028081,-120.454134||38.913229,-123.710539|38.872528,-123.659845|38.843865,-123.638637|38.798189,-123.571986|38.767656,-123.540922|38.741966,-123.514784|38.699743,-123.441773|38.596805,-123.349611|38.565542,-123.331898|38.511045,-123.249796|38.474946,-123.166427|38.390524,-123.085571|38.335209,-123.068437|38.299385,-123.053503|38.297012,-123.004121|38.295705,-123.003146|38.273164,-122.986319|38.237537,-122.987148|38.17567,-122.953629|38.112961,-122.960888|38.003438,-123.011533|37.992429,-122.974389|38.031907,-122.93971|38.016717,-122.856572|37.976656,-122.797404|37.935526,-122.754606|37.89382,-122.70264|37.906603,-122.678473|37.875125,-122.601289|37.830328,-122.537284|37.826727,-122.483483|37.852721,-122.418469|37.89341,-122.448413|37.921881,-122.486375|37.966713,-122.488665|37.996166,-122.452995|38.032165,-122.499465|38.108086,-122.491282|38.109094,-122.488499|38.142003,-122.397581|38.143449,-122.393588|38.105142,-122.301803|38.060374,-122.26932|38.051472,-122.262861|38.010309,-122.321705|38.009253,-122.342803|38.007947,-122.368891|37.978168,-122.367581|37.955671,-122.425258|37.905191,-122.378708|37.908791,-122.334529|37.893832,-122.328714|37.830086,-122.303931|37.809797,-122.33371|37.777244,-122.312974|37.755128,-122.252452|37.726406,-122.24981|37.698694,-122.213773|37.667932,-122.163049|37.667273,-122.162802|37.64077,-122.152905|37.581866,-122.144395|37.528851,-122.111997|37.521321,-122.129199|37.504143,-122.168448|37.55814,-122.244372|37.5925,-122.360218|37.707531,-122.39319|37.70833,-122.389826|37.71501,-122.361749|37.729504,-122.356784|37.738557,-122.376462|37.790724,-122.385322|37.805629,-122.398138|37.800879,-122.465396|37.77113,-122.511982|37.735567,-122.505601|37.708132,-122.500678|37.686433,-122.496783|37.612135,-122.496786|37.576138,-122.518088|37.521339,-122.516688|37.49234,-122.493789|37.46154,-122.445987|37.435941,-122.443687|37.374805,-122.409258|37.337009,-122.401322|37.314965,-122.40559|37.24852,-122.418452|37.187249,-122.397065|37.144098,-122.344029|37.115459,-122.32297|37.105141,-122.29431|37.101747,-122.284881|37.072548,-122.26048|37.013949,-122.206179|36.95595,-122.105975|36.953595,-122.067316|36.95115,-122.027174|36.97145,-121.951669|36.968949,-121.906468|36.931551,-121.862265|36.850049,-121.812732|36.815185,-121.791544|36.777543,-121.796825|36.682858,-121.814461|36.611136,-121.860603|36.634558,-121.923865|36.582753,-121.970426|36.485602,-121.941599|36.393602,-121.903195|36.30281,-121.88849|36.24186,-121.826424|36.227407,-121.779851|36.165817,-121.680145|36.099694,-121.622009|36.025156,-121.574602|36.014368,-121.531876|35.970348,-121.486199|35.885617,-121.462264|35.844623,-121.406823|35.795186,-121.347053|35.783106,-121.332448|35.713309,-121.314632|35.666711,-121.272322|35.635399,-121.166711|35.571719,-121.11424|35.460709,-121.003358|35.453742,-120.955863|35.430195,-120.884757|35.360763,-120.862133|35.294184,-120.87957|35.247876,-120.89679|35.204428,-120.846674|35.160459,-120.756085|35.175997,-120.714185|35.153061,-120.675073|35.123804,-120.635787|35.078361,-120.629583|35.033085,-120.63357|34.975166,-120.650305|34.904115,-120.670834|34.85818,-120.610266|34.738071,-120.62632|34.730709,-120.614852|34.692094,-120.60197|34.581035,-120.645738|34.554017,-120.622574|34.556958,-120.581293|34.542793,-120.550091|34.522952,-120.511421|34.447094,-120.451425|34.470623,-120.29505|34.473405,-120.141165|34.461651,-120.050681|34.444641,-119.971951|34.408795,-119.87397|34.415796,-119.835771|34.415996,-119.785871|34.395396,-119.709067|34.408297,-119.684666|34.420994,-119.616862|34.395494,-119.536957|34.378837,-119.477946|34.374063,-119.461035|34.321118,-119.37578|34.275688,-119.313034|34.25634,-119.276614|34.252903,-119.270144|34.213304,-119.257043|34.161728,-119.227742|34.094565,-119.109783|34.09047,-119.069958|34.048166,-118.954721|34.046738,-118.944479|34.034214,-118.854652|34.001238,-118.805113|34.032102,-118.744951|34.033254,-118.679365|34.039047,-118.603571|34.027509,-118.519514|33.969111,-118.460611|33.883912,-118.412707|33.804314,-118.394306|33.774715,-118.428406|33.735917,-118.396606|33.732317,-118.354704|33.721184,-118.333295|33.712817,-118.317204|33.70374,-118.258686|33.715295,-118.231926|33.736117,-118.183699|33.753217,-118.132698|33.744349,-118.116099|33.729817,-118.088896|33.654318,-118.000592|33.60552,-117.927091|33.573523,-117.840289|33.552224,-117.814188|33.487955,-117.732258|33.483426,-117.726486|33.460555,-117.715348|33.440728,-117.645582|33.386964,-117.596188|33.386629,-117.595879|33.365491,-117.547693|33.268517,-117.445583|33.168436,-117.362571|33.093504,-117.315277|33.012342,-117.28077|32.975524,-117.272139|32.900145,-117.25447|32.859673,-117.25616|32.859446,-117.256169|32.849348,-117.262904|32.851447,-117.27387|32.839546,-117.28217|32.822246,-117.28097|32.786947,-117.254969|32.70005,-117.255169|32.669352,-117.246069|32.68885,-117.196767|32.671951,-117.168866|32.618753,-117.136663|32.585601,-117.132038|32.534156,-117.124862|32.557458,-116.857153|32.576261,-116.62705|32.583747,-116.540642|32.618578,-116.106178|32.623352,-116.046619|32.667099,-115.465164|32.699676,-115.000801|32.718763,-114.719633|32.74158,-114.705716|32.734225,-114.667492|32.741052,-114.617386|32.747416,-114.570674|32.782503,-114.531746|32.845154,-114.46897|32.901883,-114.463127|32.923628,-114.476639|32.972063,-114.481315|33.023455,-114.511342|33.024628,-114.517066|33.036542,-114.575161|33.031052,-114.628292|33.037983,-114.670803|33.105335,-114.706175|33.159518,-114.679358|33.2303,-114.678097|33.255596,-114.674491|33.288078,-114.723258|33.323421,-114.707962|33.376627,-114.707347|33.405048,-114.725281|33.418298,-114.6739|33.422726,-114.635182|33.433545,-114.629146|33.490652,-114.597283|33.55223,-114.524599|33.60665,-114.529186|33.661583,-114.5252|33.693021,-114.504992|33.719154,-114.496564|33.760465,-114.504863|33.827777,-114.520465|33.864276,-114.505637|33.900639,-114.508708|33.928499,-114.534987|33.957264,-114.509567|34.010968,-114.454807|34.042615,-114.435503|34.078931,-114.430091|34.092787,-114.428026|34.11154,-114.405941|34.134457,-114.348052|34.166724,-114.292805|34.186927,-114.229715|34.239969,-114.178049|34.259538,-114.139054|34.303127,-114.140817|34.305919,-114.140929|34.344978,-114.172844|34.401329,-114.264316|34.450038,-114.335371|34.450376,-114.378851|34.51652,-114.378222|34.580711,-114.422381|34.691201,-114.465245|34.724847,-114.49097|34.815299,-114.576452|34.872889,-114.634381|34.943039,-114.629768|35.001857,-114.633486|35.139689,-114.804248|35.332011,-115.043811|35.424128,-115.160068|35.538207,-115.303743|35.617605,-115.404537|35.809358,-115.647683|35.809629,-115.648032|35.963552,-115.846113|35.999967,-115.892975|36.155804,-116.0936|36.372562,-116.375875|36.459096,-116.488233|36.847694,-117.000894|36.971207,-117.166|37.030243,-117.244916|37.353398,-117.68061|37.464938,-117.833504|37.602582,-118.02218|37.896224,-118.427995|37.949019,-118.500957|38.26894,-118.949672|38.414391,-119.157226|38.499914,-119.279262|38.534351,-119.328704|38.71315,-119.585406|38.714734,-119.587679|38.933324,-119.904314|38.999573,-120.001014|39.067495,-120.001975|39.112689,-120.002614|39.165626,-120.003364|39.291257,-120.005142|39.316475,-120.004795|39.445045,-120.003028|39.538851,-120.001739|39.722406,-119.999935|39.956505,-119.997633|40.126363,-119.997124|40.32125,-119.996155|40.720991,-119.997532|40.865899,-119.999231|41.183974,-119.999865|41.618764,-119.998279|41.874891,-119.999275|41.99454,-119.999167|41.994588,-120.181562|41.993785,-120.501068|41.993676,-120.692219|41.993483,-120.87948|41.993322,-121.035195|41.997569,-121.251099|41.997079,-121.43961|41.99719,-121.44754|42.00035,-121.675347|42.00307,-121.846712|42.005765,-122.101922|42.007763,-122.289526|42.007764,-122.289533|42.00846,-122.501135|42.00407,-122.800079|42.003048,-123.045254|42.009247,-123.145958|42.004983,-123.23073|41.999107,-123.347562|42.00164,-123.434769|41.999172,-123.519112|41.995136,-123.656997|41.995619,-123.821443|41.996146,-124.001188|41.99846,-124.211605|41.940964,-124.203401|41.846432,-124.219592|41.7923,-124.245026|41.736079,-124.19104|41.7288,-124.154245|41.709284,-124.143478|41.628849,-124.116037|41.54776,-124.081986|41.464736,-124.067473|41.439578,-124.063076|41.287695,-124.092284|41.189726,-124.122677|41.138674,-124.163988|41.087158,-124.154513|41.048504,-124.125448|40.989262,-124.118147|40.843618,-124.176715|40.659643,-124.301354|40.504953,-124.387022|40.438075,-124.409591|40.374855,-124.365357|40.331424,-124.353123|40.260973,-124.363413|40.243979,-124.343069|40.184277,-124.258404|40.130542,-124.187873|40.116349,-124.139951|40.078441,-124.087085|40.021306,-124.068908|40.013318,-124.035904|40.001299,-124.025205|39.922373,-123.954951|39.863027,-123.907663|39.83204,-123.851713|39.723071,-123.829545|39.684122,-123.792659|39.621486,-123.782322|39.552802,-123.766475|39.446537,-123.81469|39.360813,-123.825331|39.271355,-123.798991|39.193657,-123.765891|39.125326,-123.721505|39.021293,-123.69074|38.954994,-123.732891|38.913229,-123.710539

    The point should lie within above co-ordinate but it did not. For some other points and co-ordinates it works but above points and co-ordinates not working.

    Can you please and let us know what is the issue and how to resolve.

    Thanks!

      


    Balasaheb

    Wednesday, March 13, 2019 1:27 PM
  • Hi Balasaheb,

    As you are a licensed Bing Maps User, please follow the steps at https://www.microsoft.com/maps/support for Enterprise Customer Support and they can review your latest code challenges with you.

    Sincerely,

    IoTGirl

    Wednesday, March 13, 2019 5:24 PM
    Owner