C# - Offset Latitude Slightly If Not Unique?

Feb 5, 2011

I have a bunch of events with their location being pulled from the db and I am doing the following:

List<Place> placeList = new List<Place>();
foreach (var item in eventsList)
{
bool coordinateExist= placeList.Where(x => x.latitude == item.Latitude && x.longitude == item.Longitude).Count()>0;
Place place;
if (coordinateExist)
place = new Place() { title = item.Title, latitude = item.Latitude+0.0001, longitude = item.Longitude};
else
place = new Place() { title = item.Title, latitude = item.Latitude, longitude = item.Longitude};
placeList.Add(place);
}

I have a slight issue though. If two locations have the exact same latitude and longitude I want to offset the latitude by the slightest amount (equiv to a few meters maybe?), and then add it to placeList. Hence I will have a list full of unique coordinates.

how can i achieve this nicely? The above works but not nice IMO

View 2 Replies


Similar Messages:

Configuration :: When Website Is Deployed It Looks Just Slightly Different?

Apr 21, 2010

I'm experiencing a frustrating problem. I'm developing a website with ASP.NET 3.5 on a windows XP box. When a deploy it to our development server (Windows 2003, .NET 3.5 installed), I notice some forms look just slightly different. I am using the Ajax Control Toolkit as well and I have noticed that controls such as the Modal Popup look jacked up (they are not centered and the drop shadow is not directly behind the popup). Also, I have noticed differences in line wrapping and things like that. This is very frustrating because I think the site looks great and then I deploy it to give demos and some pages look screwed up. I am using the same version of IE when I view it on my local box and on the development box. Looking at the site on my local box (with IE8), it looks great. Looking at the site on the development server (with IE8 as well), it looks jacked up.

View 3 Replies

Web Forms :: Menu Control Appears Slightly Off In Chrome And Firefox?

Dec 4, 2010

The right sides of the dynamic menu items are being chopped off. Also, the entire menu is moved slightly to the left in both browsers. I have been searching for a solution but everything I find so far with Google talks about a problem with the menu not starting on the correct node but I am not having that issue.

View 2 Replies

Web Forms :: Usercontrol Which Needs To Work Slightly Differently According To The Attributes Of Its Owning Page?

May 10, 2010

I have a usercontrol which needs to work slightly differently according to the attributes of its owning page.Is there a way to determine the owning page from within the user control?

View 1 Replies

Active Directory/LDAP :: Get Unique ID Of UserName / Is GUID Is The Unique Id Of Each User

Nov 23, 2010

How to get Unique ID of LDAP logged in User? Is GUID is the unique id of each user?

View 1 Replies

Web Forms :: Is GUID (globally Unique Identifier) Unique

Aug 25, 2010

Is GUID (globally unique identifier) really unique, or it can be duplicate.

System.Guid.NewGuid().ToString()

View 6 Replies

Unique Number For Unique Visitor On Button Click In Vb.net?

Mar 21, 2011

How generate the unique no. 1,2,3 and so on .... on button click of each new user ..

the code mentioned below is a readwrite coding in vb.net ...

but the problem is it generate the same id for different users on button click event... but i want the no. of times button clicked the new ids will be generated

[code]....

View 1 Replies

Setting A Offset Value For A Particular Id?

Mar 31, 2010

i am designing a website in which i need to generate an offset value for a product(and store it in database) between 1 to 999 for every product id i store into my database from a textbox..but first it must check if a particular value starting from 1 to 999 is already taken if yes then it generates the next available number between 1 to 999..the problem is how can i retrieve and check the available numbers already stored in offset column of my database and then generate next available number?for example: if 1 ,2 ,3 ,6,8 numbers are taken offset value generated should be 4 and not 7..though its difficult to explain but if u understand my question i wuld be glad to have some code of how to achieve it??

View 1 Replies

Associating A Unique Session Id With Every Unique User In C#

Mar 18, 2011

How can I get unique session ID for every unique user who logs in ?? I'm using asp.net/c#

View 1 Replies

How To Display Data With Unique Value And Count Of That Unique Value

Feb 11, 2010

How To Display Data In Following Format?

In the Format below abc has multiple occurance which count is displayed in brackets as 2669.

[code]....

View 7 Replies

Calculating Relative Time Offset?

Oct 13, 2010

I was reading this article about relative time calculationThe problem is that the results are wrong due to the time offset. My webpage is Greek.So how should i modify that function to work correctly, including the GMT+2 or GMT+3 hours offset?

View 2 Replies

Web Forms :: Get Image Offset Position?

Apr 22, 2010

Is there anyway in .NET to get an image offset position in the webform?Javascript can get this information from the "offsetX" and "offsetY" values but are there anyway to get the same info in .NET?Or can I use javascript to catch the info and send it to the backend? Like creating a hidden input field with the data and then read the data from the code behind?

View 1 Replies

C# - Get Clients Timezone Offset From His Ip Address?

May 4, 2010

I want to get clients Time Zone offset from his IP address for my web app. I have tried using Javascripts getTimezone function, but, some clients have their timezone or time set incorrectly. I want to get the offset and render some information back on client based on their timezone.

View 4 Replies

SQL Server :: Incorrect Syntax ' OFFSET ' ! - How To Correct It

Mar 22, 2011

I have a problem and I'm at an impasse. Incorrect syntax ' OFFSET ' ! - how to correct it

View 1 Replies

AJAX :: Increase The Shadow Offset Or Width In DropShadowExtender?

Sep 27, 2010

I don't see any properties, but thought I'd ask to see if there way to increase the width of the shadow or offset of shadow from the pop-up panel or div I'm displaying?

I just want to make the pop-up appear to "stand-out" a littlle more.

<ajaxToolkit:DropShadowExtender
ID="dse"
runat="server" TargetControlID="pnlPopUp"
Opacity=".15"
Rounded="false" TrackPosition="true"
/>

View 2 Replies

AJAX :: ComboBox Results In ModalPopup Display Offset From Box?

Aug 17, 2010

My ComboBox is now rendering its button and results list on top of the ModalPopup panel

[URL] However, the results are showing up completely separate from the textbox. This is bacially the same problem described at [URL] However, forcing the position of the list did nothing and I'm already using the very latest (release) build of the toolkit (so alaa9jo's post about it being fixed in the November 2009 build isn't true for my instance).

I need the combobox functionality for my form.

why the scrollbars in comboboxes choose to show sometimes and not other? My main combobox is missing them, but the combobox reference above has them. Both use the same CSS settings and databindings; the only difference is that the one with scrollbars is inside the ModalPopup.

View 3 Replies

Web Forms :: Images Displayed Offset From Text On The Same Line?

Nov 27, 2010

I am generating a list of labels with an Image Button control at the start of each line. Unfortunately, my browser displays this list on a web page with the image higher than the label text by a few pixels. This results in a blank line of a few pixels wide between each line of text. Even the image has a blank line above it. This especially puzzles me since I went to the trouble of specifying the height, in pixels, of the image and labels. Is there any way to make the image and text appear evenly on the same line?

View 2 Replies

AJAX :: HTMLeditor In ModalPopup - 'Insert/Edit URL Link' Box Is Wildly Offset?

Jan 13, 2010

I have placed an AJAX Control Toolkit (version 3.0.30512.1) HTMLEditor inside a ModalPopup. Everything works fine except when you click the 'Insert/Edit URL Link' button. The resulting 'add a link' popup moves to the extreme bottom right of the ModalPopup - and drastically shifts the HTML Editor. This happens in Firefox, IE8 and Chrome so far. A screenshot to illustrate this is shown at the bottom of this message.

Secondly, as you can also see on this screenshot, there is a lot of white space below the HTML Editor before the Horizontal Rule - there are no other HTML tags between the HTML Editor and the Horizontal Rule. This space only 'closes up' if I increase the height of the HTML Editor - it does not reduce automatically.

View 4 Replies

Generating New Unique No From Another Unique No?

Feb 25, 2010

I am here with a task to generate a unique no of specific length from another unique no.

I want my target unique no of say z length to be generate from combination of a unique no [ that may be a serial no ] of say x length and any secret key of say y length.

View 8 Replies

How To Validate Latitude And Longitude

May 12, 2010

how to validate latitude and longitude. regex for latitude and longitude

View 3 Replies

Web Forms :: Get Location Name From Latitude And Longitude

Feb 18, 2011

I need to display the location name in the lable control based on passing the latitude and longitude values how could i do it

View 7 Replies

Get Latitude And Longitude Of Center Of Google Map?

Feb 8, 2010

how can i raise event just after user change his position in google map using dragging map and get the latitude and longitude of center of google map and the miles its showing from center. i have got lots of pages on google related to it.. but not able to solve this.. please give me solution (i am using asp.net and javascript)

View 2 Replies

Get The Longitude And Latitude From An Address Without Showing Map?

Feb 1, 2010

I want to get latitude and longitude from address in one of my asp.net application, i know it s possible using google apis but i want to do it without showing google map. How can i do that? I also want to get distance between two pairs of latitude and longitude.

View 1 Replies

Find Distance By Latitude And Longitude?

Nov 13, 2010

i am trying to find distance by latitude and longtitude by using this formula mentioned in this site.

[URL]

every thing is Ok there when i do it by calculator but when i started doing it by programmatically there is a diiference in result.

here is my part of code

lat = Convert.ToDouble( (s3[a]));
longt =Convert.ToDouble( (s4[a]));
Avg_lat = pc._Latitude - lat;
Avg_longt = pc._Longitude - longt;
a_hold =( Math.Sin(Avg_lat / 2) * Math.Sin(Avg_lat / 2) )+ (Math.Cos(pc._Latitude) * Math.Cos(lat)) * (Math.Sin(Avg_longt / 2) * Math.Sin(Avg_longt / 2));
c_hold = 2 * Math.Atan2(Math.Sqrt(a_hold), Math.Sqrt(1 - a_hold));
// c_hold = (c_hold * 180) / 3.12;
distance = 6371 * c_hold;

the problem is Math funcation here calculate the things in radian i want it in degree. so i just found a formula to convert radian into degree but that formula does'nt convert the calculation correctly..

what to do bcoz there is'nt any other option to convert radian into degree..

View 2 Replies

Web Forms :: How To Get Longitude And Latitude Of Particular Location

Mar 8, 2012

how to get longitude and latitude of particular location using C#.net web application.

Here input values are locationame,state,coutry, out put values should longitude and latitude.

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved