• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
1
Question by ysklab · Sep 03, 2018 at 12:45 PM · datamapmapsgis

import a shapefile in unity scene

Hi everyone, I need to import a shapefile into my unity scene. Could you please tell me if there is a way to do it? Thank you

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image asalaporte · Jun 07, 2019 at 09:12 AM 0
Share

Hi there,

It's been almost a year you asked this question and I am currently in need of the same thing as you were and I don't find the way of doing it (been searching quite everywhere) !! Did you have what you were searching for ? If yes, please let me know :)

Thanks in advance.

4 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by asalaporte · Jul 05, 2019 at 01:45 PM

Here is the method we used :

  • First : a C# script was written by ESRI, which is the society which created the Shapefile format. This script basically reads polylines, lines... but if you want to use it for 3D (polygon Z, type 35), you need to modify this script to add the Z axis (which we’ve done).

  • Then : In a monobehavior script (that you'll create and bind to GameObject) you will call the method of ESRI's script. This new script will allow you to catch 3DVectors.

  • Then : You call Mesh's method by using a library called Triangle.Net which will make the mesh. BUT, this last library have to be sligthly modified if you want to use it with shapefile value (which we’ve done too, by removing a directory).


Here is our work (most of it from my colleague in fact, credits to her :) ) :

I’m giving you the link to a GitHub where the files are in the states in which we’ve been able to have something drawn into Unity. My collegue is still working on it and we’ll probably push the work for you to have it (with real 3D shapefiles, PNG, greyscale heightmap correctly drawn into Unity).

https://github.com/AsaLap/ShapeFileForUnity

Technically, it works if you use the shapefile given on the GitHub and if you correctly bind the script and the ChunkPrefab to an empty GambeObject AND if you don't forget to put the path of the shapefile into the correct field (click on the GameObject with the binded script, and you'll have a field named "path" waiting for you to fill it).


Link to ESRI script :

https://www.suntabu.com/post/unity-shape-file-importer-by-esri/?fbclid=IwAR3tOCGbbx0ntcTfDeux1K7OoTCb-RkfjrI9vlGi9Fx2YkliHSD5lB9x8b4


Link to Triangle.Net :

https://archive.codeplex.com/?p=triangle&fbclid=IwAR3tOCGbbx0ntcTfDeux1K7OoTCb-RkfjrI9vlGi9Fx2YkliHSD5lB9x8b4


Really hope it can help you, sorry for the mess, we’ll try to make things clear once it’s all done :)

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
1

Answer by charlotte-andre · May 07, 2020 at 10:08 AM

Hi ! I'm the programmer of this code ! I've done a readMe of this project but forget to add it on my Git ! I'll try to find it and insert it as soon as possible !

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Nakel · Mar 03, 2021 at 03:49 AM 0
Share

Hey! it really works But all the Z values I get are equal to 1.... which still gives me a 2D design... what could it be? Also "departement.shp" attached is on 2D as well

avatar image petru23 · Nov 04, 2021 at 03:49 PM 0
Share

Hi @charlotte-andre have you find the readme file?

avatar image
0

Answer by ysklab · Jun 28, 2019 at 12:23 PM

Hi @asalaporte ; No I still looking for a solution. Do you have a solution since your last message?

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image asalaporte · Jun 28, 2019 at 12:45 PM 0
Share

Hello @ysklab , yes my collegue and I made it through ! I'll post our method here next week :)

avatar image ysklab asalaporte · Jul 05, 2019 at 08:45 AM 0
Share

Thank you @asalaporte . I am waiting to see it!

avatar image
0

Answer by JakhonGame · May 07, 2020 at 09:37 AM

Can you add readme file to your github repository? We don't know how to use it.

I am referring to this project:

[https://github.com/CharlotteAndre/ShapeFileForUnity/tree/master/Assets][1]

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

153 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How do I get list of nearby locations using Mapbox with Unity? 0 Answers

What is the best way to achieve local database for mobile? 0 Answers

Some help with Data Save/Load would be most appreciated 3 Answers

How to script TreeObject variables in runtime ? 0 Answers

Save multiple inputs for one item and print out all items 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges