Solved

save .lyr (layer file) programmatically in ArcGIS 8

Posted on 2004-04-14
2
365 Views
Last Modified: 2010-08-05
I've been up and down on Esri's website trying to find the solution to this, but can't get it to work. Basically I created a tool that when clicked creates a layer file for each map layer loaded. However they are only getting set to absolute paths, not relative so if I move it to another computer with the same structure but different drive letter it cannot find the layer. It works great through the ArcMap interface when I save a layer file manually but won't work programmatically. Something in the way the layer gets saved is the problem. Anyone have any idea how to fix this? thanks

guid
0
Comment
Question by:guidway
2 Comments
 
LVL 12

Author Comment

by:guidway
ID: 10875137
solved it, the solution is below, requesting closure of this question:

Public Sub StoreRelativeBase(inLayer As ILayer, inRelBase As String)
  Dim pDataLayer As IDataLayer2
  Set pDataLayer = inLayer
      pDataLayer.RelativeBase = inRelBase
  Dim pGxLayer As IGxLayer
  Dim pGxFile As IGxFile
     
  Set pGxLayer = New GxLayer
  Set pGxFile = pGxLayer
      pGxFile.Path = inRelBase & inLayer.Name & ".lyr"
      Set pGxLayer.Layer = inLayer
End Sub
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 10875824
Closed, 500 points refunded.
modulo
Community Support Moderator
Experts Exchange
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

I feel like more and more people want to know how to programmatically convert addresses into geospatial locations. So in this article, I will show you how you can do it with Bing Maps. I'm going to use PowerShell, which is a nice scripting language,…
Introduction This article is designed to assist GIS (Geographic Information System) and GPS (Global Positioning System) developers using ESRI ArcGIS and other spatial information management systems.   For the uninitiated the concept of projectio…
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now