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 9268221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T14:45:18+00:00 2026-06-18T14:45:18+00:00

I have a KML file with all the countries and polygons. I am trying

  • 0

I have a KML file with all the countries and polygons. I am trying to create an app that get a Lat & Lon and detecting in which country belongs using this KML. I tried SimpleKML and KMLViewer with no luck.
The kml structure is:

   <Document>
<Folder>
    <Folder>
        <name>A -</name>
        <Placemark>
            <name>Afghanistan</name>
            <description></description>
            <Style>
                <PolyStyle>
                    <color>aaffffff</color>
                    <colorMode>random</colorMode>
                </PolyStyle>
            </Style>
            <Polygon>
                <outerBoundaryIs>
                    <LinearRing>
                        <coordinates>
65.62729644775391,37.33319854736328,0 65.64692687988283,37.45888137817383,0 
...
...

coordinates>
                    </LinearRing>
                </outerBoundaryIs>
            </Polygon>
        </Placemark>
        <Placemark>
            <name>Albania</name>
 ..
 ..
 ..

1) It would be better to use xml parser and save the data on a local database?
2)Is there any function to determine in which polygonal is the given lat/lon ?

Thank you

  • 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-18T14:45:19+00:00Added an answer on June 18, 2026 at 2:45 pm

    The parsing should be pretty easy using NSXMLParser, look for names and associate them with coordinates. The more interesting part is to test the polygons for inclusion of a point.

    Here’s a highly regarded SO article, that looks like it borrows somewhat from this wikipedia article. What you would do is build a collection of polygons, and enumerate them testing each for the inclusion of some given coordinates.

    The other thing to think about is to skip the parsing and polygon testing altogether and use the google geocoding api. This section talks specifically about getting address info (including country) from a latitude and longitude.

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

Sidebar

Related Questions

I am trying to create a KML file dynamically in C#. I have wrote
I have a rails app that creates a kml file and successfully loads it
I have a KML file that I am trying to load into Google maps.
I am building a KML file using an app that I have built. Right
I can't get DDMS to load any KML files. I have a KML file
I have a kmz file that I have saved as kml to use in
I'm trying to build a KML file in Rails, which I have done successfully,
I have 3 KML's that do not draw at all and 2-3 that act
I created a KML file that defines several zones using polygons, in Google Earth.
I have a VB.NET app that generates KML to show within Google Earth. I

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.