Jump to content
Sign in to follow this  
m1lkm8n

road shapefile making guide

Recommended Posts

At zerogs request I've decided to write a quick tutorial on how rectify your road shape file and get it into the game via global mapper.

launch global mapper.then I select download free maps. select open street maps then zoom into my island which is grand manan and use the digitizer tool right click and select create area shapes and create rectangle/square specify cordinates. and dialog box opens up and i select draw a box button and draw and area around my island. then click ok. now you can save this area as a workspace under file. then i use the same digitizer tool but select create new line feature(vertex mode) and start drawing lines over where each real life road segment is. When placing additional road segments off of segments it seems to snap to the already drawn segment. left click starts drawing right click ends the segment. After each line is placed a box pops up asking for the feature attributes. the only thing we need to worry about is the feature attributes.

There are four names we need to specify.

attribute names:

_LAYER

ID

ORDER

(this number being say 0 or 1 will represent which road surface gets drawn on top of another road which also takes into account the _ID number of the roads as well. so say you have two roads. lets say a main road and a dirt path intersecting the main road going from one side across to the other side of the main road. if your main road is ORDER 0, _ID 1 and your dirt path is ORDER 0, _ID 2 the main road will overlay the dirt path that is going across the main road. however is your main road is ORDER 1 , _ID 1 and your dirt path is ORDER 0, _ID 2 the dirt path will get drawn on top of the main road first.)

_ID

Then the attributes values:

_LAYER = City Roads,Road,Path

ID = is a number

ORDER = is a number

_ID is a unique number just representing each segment. I started with 1000 then went up 2 from there. So my segments go 1000, 1002 , 1004, ect. Each _ID number must be unique or it won't work.

For defining the road type, the ID value is the attribute value you have to look at. It is the same as in roadlib.cfg and by inspecting that file, adding additional road types seems to be fairly easy. What also is easy and nice: changing road width is just a text value - so get ready for 8-lane Autobahn!

ID 1 = Highway, tar

ID 2 = Country road, tar

ID 3 = Dirt road, gravel

ID 4 = City road, concrete

ID 5 = Path, gravel

also adding in your own road sizes is as simple as adding another road class into the roadslib.cfg

you can also actually add your own road as well which works pretty good but its an extra step. \

first what I did was create my road texture and I called it mainhighway_ca.paa

then I created a _nohq.paa for the mainhighway texture.

I threw mine files in to a data folder in my roads folder (so my directory looks like this gm\grandmanan\data\roads\data) then copied a rvmat from a3's road folder over into my roads\data directory

inside the rvmat I pointed it towards my nohq texture.

I added a class into the roadslib.cgf and pointed them towards my paa files. I didn't add a end section to the road at this time as it was only for testing.

now the tricky part. after binarization i noticed the rvmat inside the roads\data folder isn't there so what I did was unpack the pbo moved the rvmat back inside where it should be and just repacked. and my roads in game. now the road was just for testing so its ridiculously huge and not very nice looking but this was just to show how to go about getting a new roads in.

edit- its so big because I didn't realize I had the width set at 30! doh

Also I moved my newly created roads into their own pbo which doesn't get binarized, only packed, so if do that you can forget about the above step.

http://i.imgur.com/jSY8Urm.jpg

I redid my main highway road.

http://imgur.com/Kcvpu48.jpg

The dialog box auto fills with two attributes which I rename.

Set each segment up like this

http://i.imgur.com/pWYX6OV.jpg

Once you map out all your road segments and are ready to export your shape file go to file export vector format and select shape file. A dialog box pops up where you can select only you shape file lines to export then you can select to export only a certain area or all loAded data.

Next thing I did was select import my height map.

if it asks for a projection select your islands projection type.

http://i.imgur.com/aObZH4y.jpg

Second I import my shape file.

right now I have my height map and shape-file set in the same coordinates as stratis as I was still figuring things out. I will change that later but for now it's ok.

Edit- it seems right now the only acceptable geo location is stratis. So you will have to rectify your shape file to statis's shape file

But since the real grandmanan is about 30 miles long and my height map is 2048 by 10 meter grid cells the road network will be way bigger.

Like this.

http://i.imgur.com/CMK5xni.jpg

So we need to rectify the shape file to our actual height map we are using.

So now with both our height map and shape file open and the layer table open right click on the shape file layer in the layer table and select rectify.

Another dialog box with open with three selection areas. The first area is the height map and shape file image where you can click and move and zoom around the map. The second and third selection is either the shape file or height map. What you need to do is place a point down by clicking on the second area box and place a corresponding point down which represents the where the first point is in the third area selection box.

Like this

http://i.imgur.com/mTtEsO2.jpg

Then click add point to list.

You need a minimum of two points to be able to rectify.

Once done placing points you click apply then ok and viola! Your road network is now shrunk to fit your islands height map. now i only placed two points down so its not really very good rectified image but you get the point.

http://i.imgur.com/tc7u4AZ.jpg

Now you can save and copy it to wherever you have your roads shape file specified in your islands config.

and youll get this

http://i.imgur.com/qaQF7rp.jpg

Thought I would point you guys here: GeoFabrick OpenStreet Map Extracts

The files located here have ESRI shape files which include forests, waterways, buildings, and most importantly roads. Why draw your roads when you can just import them? I believe you want the files that end in .shp.zip.

Unfortunately not all areas are covered with that data though. For example, I don't believe Grand Manan is covered. Although it may be possible to use one of the other file types.

So then all that's left to do is rectify the shape file with your island if they have your data already available.

anyway hope this helps

m1lkm8n

Edited by M1lkm8n

Share this post


Link to post
Share on other sites

hey great M1lkm8n, I just wanted to search for a good explanation of how to make such a shapefile, thanks for your effort, very appreciated!!

EDIT:

I managed to import my sat_lco map as I dont have an real existing world.

For those who dont know how to do this:

simply open GM and directly browse to your sat_lco.png from the menubar in GM. An info box will pop up that says that this "map" does not correspond with real existing datas bla bla ...at the end by clicking "no", you tell GM to create fake coordinates to at least view the map, this is all you want :). Zoom into the map and continue as M1lkm8n has provided above...

very awesome dude, thanks for sharing

Edited by MemphisBelle

Share this post


Link to post
Share on other sites

Thank you milk! Gonna try this tonight!

Share this post


Link to post
Share on other sites

No problem. Hopefully it's easy to understand I'm not the best a giving instructions.

I was thinking and ill have to check when I get home but I think you can export the shape file as a png as well which you can use in l3dt as a layer and just follow the lines to smooth the road areas

Share this post


Link to post
Share on other sites

Thought I would point you guys here: GeoFabrick OpenStreet Map Extracts

The files located here have ESRI shape files which include forests, waterways, buildings, and most importantly roads. Why draw your roads when you can just import them? I believe you want the files that end in .shp.zip.

Unfortunately not all areas are covered with that data though. For example, I don't believe Grand Manan is covered. Although it may be possible to use one of the other file types.

Edited by Jakerod

Share this post


Link to post
Share on other sites
Thought I would point you guys here: GeoFabrick OpenStreet Map Extracts

The files located here have ESRI shape files which include forests, waterways, buildings, and most importantly roads. Why draw your roads when you can just import them? I believe you want the files that end in .shp.zip.

Unfortunately not all areas are covered with that data though. For example, I don't believe Grand Manan is covered. Although it may be possible to use one of the other file types.

Yes I was going to put that link up. I think it's in zero's global mapper guide. But like you said I looked for grand manan which of course isn't mapped out :(

But if you can get the downloaded shape files of your area then I guess all you would have to do is just rectify

Oh also I don't see any rivers in stratis so do you think it's safe to say that's still an issue in arma?

Edited by M1lkm8n

Share this post


Link to post
Share on other sites

But if you can get the downloaded shape files of your area then I guess all you would have to do is just rectify

That, actually, is the benefit of them shapefiles: they ARE georectified!

Oh also I don't see any rivers in stratis so do you think it's safe to say that's still an issue in arma?

Hm, why not just try? Maybe just place an A2 bridge with an A3 road leading over them (or maybe only a bridge). There is that dry riverbed in the one Stratis town (which name I don't remember atm)...and AI passes over the bridge without any problem afaik (which is basically all we want but didnt get very properly in A2)

I looked for grand manan which of course isn't mapped out :(

:)

There are your https://hotfile.com/dl/199638184/7cc7592/NewBrunswickShapefiles.rar.html"]New Brunswick Shapefiles[/url] for Download, here is the result:

You can use the Geofabrik *.OSM files in GM too, just look for them in the list. Furthermore, I found shapefiles on another site I found by lookking for "Download OSM shapefiles".

?di=213641094107

Roads Shapefile (more shapes like natural objects etc. included in the package, allowing even more accurate placement)

?di=14136410948415

All stuff in a pot, so you have to delete the rest you dont want to use.

Furthermore, I realized that 10m resolution data from USGS is available as WMS layer in GM - I assume you are already using those?

Edited by ZeroG

Share this post


Link to post
Share on other sites

i am using the data from GeoFabrick OpenStreet Map Extracts, could someone explain the new/added steps..

I don't see how I can select just to get the area I want and also how to add all the info with layer, id, info..

Share this post


Link to post
Share on other sites

Wow! Thanks zero. That's awesome! I hadn't bothered looking at other sites I just looked at one and assumed after that one that none had the island mapped

I don't see how I can select just to get the area I want and also how to add all the info with layer, id, info..

I believe you just delete what you don't want and for the roads using the digitizer tool click and open up each segments attributes and you can change then there

Edited by M1lkm8n

Share this post


Link to post
Share on other sites

Reserved for something great :)

Edited by ZeroG

Share this post


Link to post
Share on other sites
Reserved for something great :)

Lol what happened to your original response. Actually in my island config I have grandmanans lat/long and map zone specified also in global mapper I have the roads in the right area as well but they still wouldn't show up in game so what I did was open stratis roads at the same time select my roads and move them till they ovelayed the stratis roads. (Not the right way but it worked) cause I closed stratis roads then exported my shape file and it was in. I had to tweak the placement but eventually I got it right.

Share this post


Link to post
Share on other sites

The main thing to remember with Open Street Map data is that it's a largely Community-driven effort - that means the quality of the data can vary a little... Some stuff is downright inaccurate, other times I've found stuff (in the UK for example), which was more useful than the commercially available Ordnance Survey data... So - check your stuff against a matching rectified sat image if at all possible.

The .shp and the .osm packages are "nominally" the same, as ZeroG's mentioned... the main visible difference being the shapefile downloads are individual "layers" and the ".osm" is "All-In-One".

However, you'll sometimes find that the ".osm" version of an area has more detail than the equivalent shapefiles pack, or there's additional layers not included in the matching .shp pack. So it's always a good idea to grab both sets of data for any area you're seriously interested in, and check them both out thoroughly - cherrypick the best of the useable data from whichever seems best.

You'll find that the .osm's seem to consist of all the shapefiles muddled together on a single layer... However, all the individual shapes are carrying "metadata" - they have ID's, names, types, etc...

Most GIS programs, GM included, have a "metadata search" function which will allow you to search that whole jumbled layer of shapes and select only those labelled "residential road" for example, or "highway"... you can then select only that "class" of shape and isolate them from the rest by copying to a new layer...

Keep doing that and you can extract a whole bunch of useful layers from lakes & rivers, thru roads, vegetation areas, agricultural areas, etc, etc... with OSM it's all down to luck as far as coverage and quality is concerned, but most times you should be able to acquire some useable stuff, and save a considerable amount of time....

B

Share this post


Link to post
Share on other sites

Ok, progress report:

1. What I can do is open up the A3 Stratis road shapefile and delete/edit existing roads as well as create new ones. That works with TM and UTM projection.

2. I seem not to be able to create a new shapefile from scratch on another spot of the world - although corresponding ro my map, they do not appear there! My map is 20480 x 20480 and I had to georectify that although it is RL data...not optimal :(

A3 Stratis road shapefile again, the base of the X and Y Axis at those coordinates: 0° 0' 0'' NORTH (Equator), 6° 18' 18'' EAST and I havent yet found a hint to change this in the config. I changed the mapzone value etc, yet still this area seems to be the one we have to use and rectify our images to so that proper road painting with shapefiles can happen. Anyone else better luck? Is it sth with the shapefile metadata?

For defining the road type, the ID value is the attribute value you have to look at. It is the same as in roadlib.cfg and by inspecting that file, adding additional road types seems to be fairly easy. What also is easy and nice: changing road width is just a text value - so get ready for 8-lane Autobahn!

ID 1 = Highway, tar

ID 2 = Country road, tar

ID 3 = Dirt road, gravel

ID 4 = City road, concrete

ID 5 = Path, gravel

Edited by ZeroG

Share this post


Link to post
Share on other sites
Ok, progress report:

1. What I can do is open up the A3 Stratis road shapefile and delete/edit existing roads as well as create new ones. That works with TM and UTM projection.

2. I seem not to be able to create a new shapefile from scratch on another spot of the world - although corresponding ro my map, they do not appear there! My map is 20480 x 20480 and I had to georectify that although it is RL data...not optimal :(

A3 Stratis road shapefile again, the base of the X and Y Axis at those coordinates: 0° 0' 0'' NORTH (Aequator), 6° 18' 18'' EAST and I havent yet found a hint to change this in the config. I changed the mapzone value etc, yet still this area seems to be the one we have to use and rectify our images to so that proper road painting with shapefiles can happen. Anyone else better luck? Is it sth with the shapefile metadata?

For defining the road type, the ID value is the attribute value you have to look at. It is the same as in roadlib.cfg and by inspecting that file, adding additional road types seems to be fairly easy. What also is easy and nice: changing road width is just a text value - so get ready for 8-lane Autobahn!

ID 1 = Highway, tar

ID 2 = Country road, tar

ID 3 = Dirt road, gravel

ID 4 = City road, concrete

ID 5 = Path, gravel

that's awesome. so defining additional wider roads is as simple as adding an additional class to the roadslib.cfg now if I can just figure out why my shapefile wont work with the correct projections.

also I added your ids to the main page

Share this post


Link to post
Share on other sites
..at the end by clicking "no", you tell GM to create fake coordinates to at least view the map, this is all you want :). Zoom into the map and continue as M1lkm8n has provided above...

And your roads showed up ingame using fake coordinates? How?

Share this post


Link to post
Share on other sites

Thx for this nice guide guys,

but can someone explain the "rectifying" part a little bit more, because i dont get it. ;-)

I have downloaded some terrain data + the roads.shp but the roads are a little bit "rotated".

Share this post


Link to post
Share on other sites

I should probably clarify that rectifying part there at the end. Technically when you download the data from global mapper it is already geo-rectified. The reason I had to rectify my road shape file was because I had taken the height map I wanted and shrunk it to fit the size I wanted but in doing so I needed to shrink the road network as well.

When you rectify you click on one map (which is the second image when the rectify box pops up) and set a point. Then on the third image box set another point which corresponds to the first point you set.

Usually you can do one in the top left and one in the bottom right of your image boxes.

Hopefully this helps. Maybe zerog can weight in here. He is much more knowledgable using global mapper.

Share this post


Link to post
Share on other sites

Hmm, well...the more points you rectify and the more you Zoom in when defining these spots, the better the result in game will be.

What is it exactly that you dont understand?

Share this post


Link to post
Share on other sites

I'm sorry for bringing this up after so much time, i've been scratching my head for a few hours trying to figure out how things work differently in A3.

I've opened the stratis_data\roads folder and found files that as far as i know were not needed in A2 (roadlib.cfg, etc).

Does that mean that i have to go through all the steps in OP everytime i want to create a road in A3/V3 now or i can keep using the old "roads" tool with the road objects like it was in A2? If so, which ones?

Also, has anybody tried using the A3MP roads/objects yet?

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×