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

  • Home
  • SEARCH
  • 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 8678679
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:47:03+00:00 2026-06-12T20:47:03+00:00

I have a function where the user uploads a KML file, I use XSLT

  • 0

I have a function where the user uploads a KML file, I use XSLT to convert it to GML and then save it to another file. My question is how can I import this GML data to the geometry column using GeomFromGML() in MVC?

Totally stumped and can’t find any good examples. Below is my code for the upload and transformation:

var fileName = Path.GetFileName(Polygon.FileName);
                var path = Path.Combine(Server.MapPath("~/App_Data/uploads"),fileName);
                Polygon.SaveAs(path);
                XPathDocument myXPathDoc = new XPathDocument(path);
                XslCompiledTransform myXslTrans = new XslCompiledTransform();
                myXslTrans.Load(Server.MapPath("~/App_Data/XSL/kml2gml2.xsl"));
                var gml = Path.Combine(Server.MapPath("~/App_Data/GML/gml.xml"));
                XmlTextWriter myWriter = new XmlTextWriter(gml, null);
                myXslTrans.Transform(myXPathDoc, null, myWriter);
  • 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-12T20:47:06+00:00Added an answer on June 12, 2026 at 8:47 pm

    I never had any luck with the GeomFromGML() so instead I use the NetTopologySuite. It contains two classes:
    GMLReader and WKTWriter that you can use to first read the GML and then write it to WKT. The WKT can be inserted into the database using the STGeomFromtext to save it in your SQL Database:

    GMLReader gmlr = new GMLReader();
    WKTWriter wktw = new WKTWriter();
    IGeometry g = gmlr.Read(gmlxml);
    string wkt = wktw.Write(g);
    string sql = "INSERT INTO mytable (GeomCol) VALUES (geometry::STGeomFromText('"+wkt+"', 0));";
    

    Or perhaps your XSLT can be used to transform the KML directly to WKT?

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

Sidebar

Related Questions

I have a upload function in my app. this function uploads an excel file
I want to have a user select a file and then have php put
In my Codeigniter controller have the following private function which validates file uploads. private
I have a code like that: User = function(){} User.a = function(){ return try;
Inside my Controller i have function that runs after user clicks on item, which
I have the following class in javascript: function User(aJid){ this.jid = aJid; this.name =
I have this code App.Model('users').find(function (err, users) { users.forEach(function(user) { console.log(user.username); }); }); //make
i have this function pymssql.connect(host=my host,user=my user,password=my pass,database=mydb) I want to read the user
I have code like function populate...() { var user = $.storage.get(particulars); if (user) {
I have a function in a class file called auth_user and its in App_code

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.