Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7736765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T07:49:32+00:00 2026-06-01T07:49:32+00:00

I am attempting to load a table of shape coordinates out of a database

  • 0

I am attempting to load a table of shape coordinates out of a database for plotting on a silverlight bing map, The table structure I am interested in is here http://dl.dropbox.com/u/10440538/ADO.png.

Using a wcf ria service I can load the data ok, but I need help with my code to pull out the lowest level data (the coordinates) and separate them into collections. The end result should be so that I have a collection of LocationCollections, one LocationCollection for each mapshape in the database.

This is my loadoperation callback

    void FarmsLoaded(LoadOperation<Farm> loadOp) {

        LocationCollection lc = new LocationCollection();

        foreach (Farm f in loadOp.Entities) {
            foreach (FarmLocation fl in f.FarmLocations) {
                foreach (MapShape ms in fl.MapShapes) {
                    lc.Clear();
                    foreach (MapPoint mp in ms.MapPoints) {
                        lc.Add(new Location(mp.Latitude, mp.Longitude));
                    }
                    shapeList.Add(lc);   //observablecollection of LocationCollections
                }
            }
        }
    }

shapeList is then bound to a map layer. Unfortunately when I run this only the last mapshape in the db is drawn. I think I misunderstand how the foreach nesting is being traversed so I’d appreciate any effort at enlightenment on correct use of nested foreach in this situation, or any alternate suggestions if foreach is not appropriate (LINQ?)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T07:49:36+00:00Added an answer on June 1, 2026 at 7:49 am

    I think the problem is not related to foreach loop, but instead clearing of lc. Since you are claring lc on for each mapshape, they seem to be deleted from shapelist as well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm attempting to following the tutorials found here: http://www.ifadey.com/2010/06/crud-using-jquery-and-codeigniter/ My code is updated to
I am attempting to load customer objects from my database where the customer's name
Using NPOI and attempting to follow a tutorial here: http://www.zachhunter.com/2010/05/npoi-excel-template/ , I'm coming across
So basically I am thinking about attempting load testing on my asp.net application using
Im attempting to load a hex literal from an xml settings file, I can
I am attempting to load some images into a very basic C++/SDL based program.
I am attempting to load multiple images in AS3 and I'm exploring different options
I am having an issue on my site where I am attempting to load
I'm attempting to just change the background colour of a webpage upon page load.
I'm attempting to load the resulting swf of a swc build manually. Due to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.